summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/invidious/yt_backend/extractors_utils.cr17
1 files changed, 7 insertions, 10 deletions
diff --git a/src/invidious/yt_backend/extractors_utils.cr b/src/invidious/yt_backend/extractors_utils.cr
index 0cb3c079..b247dca8 100644
--- a/src/invidious/yt_backend/extractors_utils.cr
+++ b/src/invidious/yt_backend/extractors_utils.cr
@@ -68,19 +68,16 @@ rescue ex
return false
end
-def extract_videos(initial_data : Hash(String, JSON::Any), author_fallback : String? = nil, author_id_fallback : String? = nil) : Array(SearchVideo)
- extracted, _ = extract_items(initial_data, author_fallback, author_id_fallback)
+# This function extracts the SearchItems from a Category.
+# Categories are commonly returned in search results and trending pages.
+def extract_category(category : Category) : Array(SearchVideo)
+ items = [] of SearchItem
- target = [] of (SearchItem | Continuation)
- extracted.each do |i|
- if i.is_a?(Category)
- i.contents.each { |cate_i| target << cate_i if !cate_i.is_a? Video }
- else
- target << i
- end
+ category.contents.each do |item|
+ target << cate_i if item.is_a?(SearchItem)
end
- return target.select(SearchVideo)
+ return items
end
def extract_selected_tab(tabs)
image redirect supportJason Kim No longer redirect image links for teddit instances. Add a comment detailing the two issues I found. Now, the feature should be stable. 2021-04-09fix: don't redirect for rest of instancesJason Kim Unbreak old.reddit.com and i.reddit.com by ignoring image redirects for them. 2021-04-08fix: redirect teddit differentlyJason Kim Teddit image urls are different from libreddit. Handle each separately. Test manually: - libredd.it: pass - libreddit.spike.codes: pass - libreddit.kavin.rocks: pass - libreddit.insanity.wtf: fail (site doesn't work in general) - libreddit.dothq.co: pass - teddit.net: mostly fail - teddit.ggc-project.de: mostly fail - teddit.kavin.rocks: mostly fail - old.reddit.com: fail - i.reddit.com: fail - snew.notabug.io: fail (site doesn't work in general) Teddit image urls have two issues. First, the links almost never work (404) if the image url is visited directly before visiting the main page. Once the main page is visited, however, the image url starts working. I'm guessing this is an issue with teddit instances not fetching images unless the main page is accessed. Second, some image links are different/incompatible for some reason. For example, <https://i.redd.it/htg3owj12ok21.png> turns into <https://teddit.net/pics/w:null_TpEyuHnjif6578pV0lBuM-kNW1bXqxbvqbOHjhRZVr0.png>. Libreddit seems to not have this issue. 2021-04-08feat: add img prefix for i.redd.itJason Kim "i.redd.it/<imgfile>" redirects "libredd.it/<imgfile>". Make it redirect to "libredd.it/img/<imgfile>". Tested only for "libredd.it". 2021-04-08feat: add i.redd.it to reddit targetsJason Kim Add "i.redd.it" to list of urls to redirect for Reddit. Although the redirect works, the link should be invalid because it still needs an "img" path prefix. 2021-04-07Update Bibliogram instances listCadence Ember Set it to match the list of actually working instances. https://git.sr.ht/~cadence/bibliogram-docs/tree/master/docs/Instances.md 2021-04-05Update manifest.jsonHarsh Barsaiyan 2021-03-30Add ViewTubeHarsh Barsaiyan 2021-03-20Add Ecosia search engineCamille019 2021-03-11Add Whoogle SearchHarsh Barsaiyan 2021-03-02Disable SimplyTranslate redirects by defaultfattalion 2021-02-25Add SimplyTranslate supportfattalion 2021-02-24add invidious instanceAndrew Zhao