Auto-import-ytb - crontab needed? Where?

Hi all,

I try to sync video’s from my wife’s Youtube channel to her Peertube instance using auto-import-ytb.

TL;WR so far:

  • Initially I used the Youtube credentials instead of Peertube credentials; corrected
  • Initially I used the Youtube channel instead of Peertube channel, and when I used the Peertube channel, I used the name instead of the (numerical) ID; corrected
  • Logging at debug level does show the entered details are being registered
    {"parameters":{"settings":{"ytb-urls":"[{\"address\":\"https://www.youtube.com/feeds/videos.xml?channel_id=UCTDKPYy0hh85PLmhWuCGgaw\",\"ChannelId\":\"3\",\"timeloop\":3} \n]\n","admin-name":"minda","admin-password":"secret password of minda"}},"level":"debug","message":"Checking enabledPluginValidator parameters","label":"linhtran.eu:443","timestamp":"2021-11-28T12:29:42.422Z"}
    {"message":"Configuration changed: [{\"address\":\"https://www.youtube.com/feeds/videos.xml?channel_id=UCTDKPYy0hh85PLmhWuCGgaw\",\"ChannelId\":\"3\",\"timeloop\":3} \n]\n","level":"debug","label":"linhtran.eu:443 peertube-plugin-auto-import-ytb","timestamp":"2021-11-28T12:29:42.457Z"}
    
    
  • Youtube-channel-URL gives a screen full of text in my browser: OK?
  • Logging does not show any activity besides registering plugin details

According to the documentation, the plugin will check every five minutes by default. I think I followed the documentation to the letter, but no video has showed up the past hour so I think something must go wrong.

Logging seems verbose enough, but I don’t see any mention of ‹ youtube ›, ‹ ytb › or the channel ID.

Do I need to activate the plugin in one way or another, or do I look in the wrong log?

Some context:

  • Peertube is installed via Yunohost
  • I created an app password for Peertube. Google says it has not been used
  • What else can I provide?

I don’t know if the plugin developper is reading this forum. Perhaps you can try to ask on the plugin repository? Outils-PeerTube/peertube-plugin-auto-import-ytb - peertube-plugin-auto-import-ytb - Gitea

Thank you for the suggestion, I will try that!

« Tant pis », the repository is closed for registration, there is no contact information, without a doxing attempt I won’t be able to contact them :wink:

But! After having a look at the sources and retracing my steps through the logs, it turns out I was blind or overlooked things one way or another. These lines caught my attention:

{"level":"info","message":"Do not login user (youtube-account) because admin did not configure LDAP.","label":"linhtran.eu:443 peertube-plugin-auth-ldap","timestamp":"2021-11-28T08:51:00.696Z"}

This is for the ldap-plugin I got ‹ for free › via the Yunohost installation, but it made me think, maybe I need to configure the auto-import-plugin with a Peertube user; there is this access token error just a few lines lower:

{"message":"Error during the credential validation : Error: Cannot get access Token : Bad Request","level":"warn","label":"linhtran.eu:443 peertube-plugin-auto-import-ytb","timestamp":"2021-11-28T08:51:00.706Z"}

I now tried a number of options for ‹ admin username › in the plugin settings:

  • Youtube account via app-password: Error: Cannot get access Token
  • Youtube account directly: Error: Cannot get access Token
  • Peertube admin account: error on first try, not afterwards

I did service peertube restart after changing the plugin settings, to be sure, but it seems the error gets logged directly after saving the setting (so it is executed when making the change, not when starting the server?)

I am (a bit?) confused that there was an error for the Peertube account once, but not after that, then again, maybe I make a mismatch between my actions and the log lines (the actual login attempt is not logged, only « Error » without account info).

Maybe I am a step further now, but video’s still don’t show up. There is logging on 5 minute intervals for ‹ live video views › in tail -f peertube, but nothing related to auto-import-ytb.

;-( I broke my instance for a while. I figured: « Maybe the import-plugin tries to use the LDAP-plugin, and can’t continue. Let’s remove the LDAP plugin! » and, « Let’s increase the logging level to debug! »

Then the server didn’t start anymore. Panicking at first, I thought to reinstall Peertube, but then thought of running Yunohost diagnosis and logs. It turned out I killed a # in /var/www/peertube/production.yaml. After putting it back, the server ran again.

Another thing I thought of: if the admin account in the plugin is about Peertube, maybe the channelId is also about Peertube! I changed it, now I’ll let it rest for 10-15 minutes and see if it did anything (either log errors, or perhaps import a video :slight_smile: I’ll update the thread anyway later today).

No good. A little step further: setting the logging to debug gave the actual parameters found by the plugin (they are equal to my input), but no insight in whether the plugin is actually running.

Turning on prettify_sql = true broke the configuration, and the server would not start; reverting to prettify_sql = false made it working again.

The log when opening the config of auto-import-ytb in the browser and saving it gives:

{"parameters":{"settings":{"ytb-urls":"[{\"address\":\"https://www.youtube.com/feeds/videos.xml?channel_id=UCTDKPYy0hh85PLmhWuCGgaw\",\"ChannelId\":\"linh.ha.lan\",\"timeloop\":3} \n]\n","admin-name":"minda","admin-password":"secret password of minda"}},"level":"debug","message":"Checking enabledPluginValidator parameters","label":"linhtran.eu:443","timestamp":"2021-11-28T12:29:42.422Z"}
{"message":"Configuration changed: [{\"address\":\"https://www.youtube.com/feeds/videos.xml?channel_id=UCTDKPYy0hh85PLmhWuCGgaw\",\"ChannelId\":\"linh.ha.lan\",\"timeloop\":3} \n]\n","level":"debug","label":"linhtran.eu:443 peertube-plugin-auto-import-ytb","timestamp":"2021-11-28T12:29:42.457Z"}

Seems OK. When I click the linkified link in the console, it picks up the \ for escaping " as part of the URL, but when I just take the URL and paste it in a browser it gives me a screen full of videodetails.

One step closer again!

The definition of the import is:

type SettingsContent = {
  address: string;
  channelId: string;
  timeloop?: number;
};

On rereading the documentation, I noticed

The number of the channel can be found in the database (maybe somewhere else, but I am not familiar enough with Peertube yet):

select vc.id as "this is the number"
     , vc.name
     , vc.description
     , a.id
     , a.type
     , a.url
  from "videoChannel" as vc 
  join actor as a 
    on a.id = vc."actorId" 
-- where vc.name = 'linh.ha.lan'
;

If you got more than one row, pay attention to the name and the url of the result records.

Anyway, the import plugin functionality is not impressed: still nothing is happening :frowning:

My crontab is empty, no idea whether the plugin should show up there or that it can use another mechanism for frequent runs.

Should I be able to run the plugin manually?

It is located at:

/home/yunohost.app/peertube/storage/plugins/node_modules/peertube-plugin-auto-import-ytb/dist/lib/peertubeRequester.js 

Running

# cd /var/www/peertube
# node   /home/yunohost.app/peertube/storage/plugins/node_modules/peertube-plugin-auto-import-ytb/dist/lib/peertubeRequester.js 

gives no feedback, not on the command line nor in the peertube log.