Introduction
Introduction Statistics Contact Development Disclaimer Help
youtube: remove (old) commented code - frontends - front-ends for some sites (e…
Log
Files
Refs
README
LICENSE
---
commit 37b2d730f7010f8c852286715accd38ca7674b00
parent f47b9452628b9a68e527b7872771b08ef47e38c4
Author: Hiltjo Posthuma <[email protected]>
Date: Sat, 18 Feb 2023 11:33:52 +0100
youtube: remove (old) commented code
Diffstat:
M youtube/youtube.c | 25 -------------------------
1 file changed, 0 insertions(+), 25 deletions(-)
---
diff --git a/youtube/youtube.c b/youtube/youtube.c
@@ -104,11 +104,7 @@ processnode(struct json_node *nodes, size_t depth, const c…
/* new item, structures can be very deep, just check the end for:
(items|contents)[].videoRenderer objects */
if (depth >= 3 &&
-// nodes[depth - 3].type == JSON_TYPE_ARRAY &&
-// nodes[depth - 2].type == JSON_TYPE_OBJECT &&
nodes[depth - 1].type == JSON_TYPE_OBJECT &&
-// (!strcmp(nodes[depth - 3].name, "items") ||
-// !strcmp(nodes[depth - 3].name, "content")) &&
!strcmp(nodes[depth - 1].name, "videoRenderer")) {
r->nitems++;
return;
@@ -119,27 +115,18 @@ processnode(struct json_node *nodes, size_t depth, const …
item = &(r->items[r->nitems - 1]);
if (depth >= 4 &&
-// nodes[depth - 4].type == JSON_TYPE_ARRAY &&
-// nodes[depth - 3].type == JSON_TYPE_OBJECT &&
-// nodes[depth - 2].type == JSON_TYPE_OBJECT &&
nodes[depth - 1].type == JSON_TYPE_STRING &&
-// (!strcmp(nodes[depth - 4].name, "items") ||
-// !strcmp(nodes[depth - 4].name, "contents")) &&
!strcmp(nodes[depth - 2].name, "videoRenderer") &&
!strcmp(nodes[depth - 1].name, "videoId")) {
strlcpy(item->id, value, sizeof(item->id));
}
if (depth >= 7 &&
-// nodes[depth - 7].type == JSON_TYPE_ARRAY &&
-// nodes[depth - 6].type == JSON_TYPE_OBJECT &&
nodes[depth - 5].type == JSON_TYPE_OBJECT &&
nodes[depth - 4].type == JSON_TYPE_OBJECT &&
nodes[depth - 3].type == JSON_TYPE_ARRAY &&
nodes[depth - 2].type == JSON_TYPE_OBJECT &&
nodes[depth - 1].type == JSON_TYPE_STRING &&
-// (!strcmp(nodes[depth - 7].name, "items") ||
-// !strcmp(nodes[depth - 7].name, "contents")) &&
!strcmp(nodes[depth - 5].name, "videoRenderer") &&
!strcmp(nodes[depth - 4].name, "title") &&
@@ -150,13 +137,10 @@ processnode(struct json_node *nodes, size_t depth, const …
}
if (depth >= 5 &&
-// nodes[depth - 5].type == JSON_TYPE_ARRAY &&
nodes[depth - 4].type == JSON_TYPE_OBJECT &&
nodes[depth - 3].type == JSON_TYPE_OBJECT &&
nodes[depth - 2].type == JSON_TYPE_OBJECT &&
nodes[depth - 1].type == JSON_TYPE_STRING &&
-// (!strcmp(nodes[depth - 5].name, "items") ||
-// !strcmp(nodes[depth - 5].name, "contents")) &&
!strcmp(nodes[depth - 3].name, "videoRenderer") &&
!strcmp(nodes[depth - 1].name, "simpleText")) {
if (!strcmp(nodes[depth - 2].name, "viewCountText") &&
@@ -172,7 +156,6 @@ processnode(struct json_node *nodes, size_t depth, const ch…
}
if (depth >= 9 &&
-// nodes[depth - 9].type == JSON_TYPE_ARRAY &&
nodes[depth - 8].type == JSON_TYPE_OBJECT &&
nodes[depth - 7].type == JSON_TYPE_OBJECT &&
nodes[depth - 6].type == JSON_TYPE_OBJECT &&
@@ -181,8 +164,6 @@ processnode(struct json_node *nodes, size_t depth, const ch…
nodes[depth - 3].type == JSON_TYPE_OBJECT &&
nodes[depth - 2].type == JSON_TYPE_OBJECT &&
nodes[depth - 1].type == JSON_TYPE_STRING &&
-// (!strcmp(nodes[depth - 9].name, "items") ||
-// !strcmp(nodes[depth - 9].name, "contents")) &&
!strcmp(nodes[depth - 7].name, "videoRenderer") &&
!strcmp(nodes[depth - 6].name, "longBylineText") &&
!strcmp(nodes[depth - 5].name, "runs") &&
@@ -194,15 +175,12 @@ processnode(struct json_node *nodes, size_t depth, const …
}
if (depth >= 7 &&
-// nodes[depth - 7].type == JSON_TYPE_ARRAY &&
nodes[depth - 6].type == JSON_TYPE_OBJECT &&
nodes[depth - 5].type == JSON_TYPE_OBJECT &&
nodes[depth - 4].type == JSON_TYPE_OBJECT &&
nodes[depth - 3].type == JSON_TYPE_ARRAY &&
nodes[depth - 2].type == JSON_TYPE_OBJECT &&
nodes[depth - 1].type == JSON_TYPE_STRING &&
-// (!strcmp(nodes[depth - 7].name, "items") ||
-// !strcmp(nodes[depth - 7].name, "contents")) &&
!strcmp(nodes[depth - 5].name, "videoRenderer") &&
!strcmp(nodes[depth - 4].name, "longBylineText") &&
!strcmp(nodes[depth - 3].name, "runs")) {
@@ -232,14 +210,12 @@ youtube_search(const char *rawsearch, const char *page, c…
return NULL;
if (extractjson(s, &start, &end) == -1) {
-// fprintf(stderr, "error extracting JSON");
free(r);
return NULL;
}
ret = parsejson(start, end - start, processnode, r);
if (ret < 0) {
-// fprintf(stderr, "error parsing JSON");
free(r);
return NULL;
}
@@ -273,7 +249,6 @@ youtube_channel_videos(const char *channelid)
ret = parsejson(start, end - start, processnode, r);
if (ret < 0) {
-// fprintf(stderr, "error parsing JSON");
free(r);
return NULL;
}
You are viewing proxied material from codemadness.org. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.