RSSHub
RSSHub copied to clipboard
Youtube subscriptions fails if channel is deleted
Routes
/youtube/subscriptions
Full routes
/youtube/subscriptions
Related documentation
https://docs.rsshub.app/routes/social-media#subscriptions
What is expected?
Expected list of subdcriptions
What is actually happening?
Error in /youtube/subscriptions: TypeError: Cannot read properties of undefined (reading '0')
I was subscribed to invalid channel, https://www.youtube.com/channel/UCIi2Tk2POJkRgWHD7HGBa7Q
request: https://youtube.googleapis.com/youtube/v3/channels?part=contentDetails&id=UCIi2Tk2POJkRgWHD7HGBa7Q&key=API_KEY
response in https://developers.google.com/oauthplayground:
{
"kind": "youtube#channelListResponse",
"etag": "RuuXzTIr0OoDqI4S0RU6n4FqKEM",
"pageInfo": {
"resultsPerPage": 5,
"totalResults": 0
}
}
logs to find it:
response in app:
{
config: {
url: 'https://youtube.googleapis.com/youtube/v3/channels?part=contentDetails&id=UCIi2Tk2POJkRgWHD7HGBa7Q&key=****',
method: 'GET',
userAgentDirectives: [ [Object] ],
paramsSerializer: [Function (anonymous)],
headers: {
'x-goog-api-client': 'gdcl/7.0.1 gl-node/21.7.1',
'Accept-Encoding': 'gzip',
'User-Agent': 'google-api-nodejs-client/7.0.1 (gzip)'
},
params: {
part: 'contentDetails',
id: 'UCIi2Tk2POJkRgWHD7HGBa7Q',
key: '****'
},
validateStatus: [Function (anonymous)],
retry: true,
responseType: 'unknown',
errorRedactor: [Function: defaultErrorRedactor]
},
data: {
kind: 'youtube#channelListResponse',
etag: 'RuuXzTIr0OoDqI4S0RU6n4FqKEM',
pageInfo: { totalResults: 0, resultsPerPage: 5 }
},
headers: {
'alt-svc': 'h3=":443"; ma=2592000,h3-29=":443"; ma=2592000',
'cache-control': 'private',
connection: 'close',
'content-encoding': 'gzip',
'content-type': 'application/json; charset=UTF-8',
date: 'Sat, 16 Mar 2024 00:43:28 GMT',
server: 'scaffolding on HTTPServer2',
'transfer-encoding': 'chunked',
vary: 'Origin, X-Origin, Referer',
'x-content-type-options': 'nosniff',
'x-frame-options': 'SAMEORIGIN',
'x-xss-protection': '0'
},
status: 200,
statusText: 'OK',
request: {
responseURL: 'https://youtube.googleapis.com/youtube/v3/channels?part=contentDetails&id=UCIi2Tk2POJkRgWHD7HGBa7Q&key=****'
}
There are broken channels, that has no items, so they should be skipped here: https://github.com/DIYgod/RSSHub/blob/master/lib/routes/youtube/subscriptions.ts#L59C160-L59C163
Deployment information
Self-hosted
Deployment information (for self-hosted)
docker-compose latest
Additional info
_
This is not a duplicated issue
- [X] I have searched existing issues to ensure this bug has not already been reported