MarcelRobitaille / bbyen

Bring Back YouTube Email Notifications! YouTube upload email notification replacement
MIT License
10 stars 0 forks source link

Whitelist setup instructions #10

Closed Dwarih closed 2 years ago

Dwarih commented 2 years ago

Hey,

I just found this project and I'm trying to set it up using the whitelist mentioned in https://github.com/MarcelRobitaille/bbyen/issues/6 I did not find any mention about it in the setup instructions. Is it possible to update it? It was a bit harder to notice that whitelistedChannelIds needs to be used in order for the function to work properly (instead of whitelistChannelIds)

MarcelRobitaille commented 2 years ago

Thanks for the report @Dwarih. Sorry about that. I guess I have not been good about updating the docs for every issue.

I added a section about that to the README. I also took this opportunity to make using the software easier. Now, you can paste the channel page's URL instead of the ID. This will make it easier to populate, especially if the channel uses a custom URL making the ID hard to find.

NightMean commented 2 years ago

Perfect! That makes it easier. I used window["ytInitialData"].metadata.channelMetadataRenderer.rssUrl in browser console to get me the RSS link as a workaround.

Long time ago I used this script to automatically fetch the channelID which then wrote it to an XML file. Perhaps similar thing can be used in future for bbyen as well. It might not be elegant, but it did the job :) Just a suggestion, not really a feature request

Youtube_Add_subscription.py

MarcelRobitaille commented 2 years ago

@NightMean Thanks for the suggestion. That's a nice way to get it manually if the channel has a custom URL. I would not use this method to extract it automatically. We are currently not scraping the HTML, and this would require evaluating JS as well. I will add it as a manual method.

Dwarih commented 2 years ago

@MarcelRobitaille Thanks for updating the instructions! :) Now it is easily understandable.

I'm using whitelisted option but upon entering the channel channel URL where the channel ID is shown or even if there isn't any and channel name is used instead, I can see an error message. Is this the correct way to enter the URL into the config?

    "whitelistedChannelIds": [
    "https://www.youtube.com/channel/UCBQZwaNPFfJ1gZ1fLZpAEGw",
    "https://www.youtube.com/c/AureliusTjin"
    ]

Error message:

C:\Downloads\bbyen-master\src\config.js:29
                return res.data.items[0].id.channelId
                                         ^

TypeError: Cannot read properties of undefined (reading 'id')
    at normalizeChannel (C:\Downloads\bbyen-master\src\config.js:29:28)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async Promise.all (index 0)
    at async normalizeConfig (C:\Downloads\bbyen-master\src\config.js:40:6)
    at async loadConfig (C:\Downloads\bbyen-master\src\config.js:48:27)

@NightMean thanks for sharing the console command, will definitely use it next time.

MarcelRobitaille commented 2 years ago

Ok, that might happen if it cannot find the channel id through the API. As far as I can tell, there is no official way to get the channel ID given its URL. What I have implemented is searching youtube for the channel URL and taking the ID of the result, which is what I have seen other people doing. I am assuming that happened for the first one. Do you know?

Dwarih commented 2 years ago

I've changed the config but I still get the same error message.

    "whitelistedChannelIds":[
    "https://www.youtube.com/channel/UCBQZwaNPFfJ1gZ1fLZpAEGw"
    ]

Leaving only the ChannelID from above results into this error: [error] [main]: Cannot destructure property 'filename' of 'undefined' as it is undefined.

It does not seem to check for videos or subscriptions. I did not touch the filename of the database so I'm not sure what is wrong there.

    "database": {
        "filename": "database.sqlite"
MarcelRobitaille commented 2 years ago

Should be fixed in the latest commit. I was able to get the ID for both of those links you provided. I also added better error handling.

I'm not sure where that other issue comes from. I will look into it.

MarcelRobitaille commented 2 years ago

Ok. It was just a stupid mistake. I forgot to await the new config parsing function that returns a promise. I should really use typescript. Should be working now.

Dwarih commented 2 years ago

No worries! Thanks for the quick fix. Both Channel IDs got converted correctly and after using the latest commit videos and subscriptions are now being check! :)

MarcelRobitaille commented 2 years ago

Glad to hear it! Closing this