Fixed weeb search, default anime

This commit is contained in:
benjamyn committed 2021-06-05 12:48:17 +10:00
1 parent 81d24e4c49
commit cbc72c9f21
3 files changed
+14 -7

No files matched your search

+1
View File
@@ -0,0 +1 @@
{"kind": "Listing", "data": {"after": "t3_nht5mr", "dist": 25, "facets": {}, "modhash": "", "children": [{"kind": "t3", "data": {"approved_at_utc": null, "subreddit": "Animewallpaper", "selftext": "", "author_fullname": "t2_3urr0m79", "saved": false, "mod_reason_title": null, "gilded": 0, "clicked": false, "title": "Mai-san in pajamas [Seishun Buta Yarou] (4000\u00d72250)", "link_flair_richtext": [], "subreddit_name_prefixed": "r/Animewallpaper", "hidden": false, "pwls": 0, "link_flair_css_class": "two", "downs": 0, "thumbnail_height": 78, "top_awarded_type": null, "hide_score": false, "name": "t3_nem8uj", "quarantine": false, "link_flair_text_color": "dark", "upvote_ratio": 1.0, "author_flair_background_color": null, "subreddit_type": "public", "ups": 1248, "total_awards_received": 0, "media_embed": {}, "thumbnail_width": 140, "author_flair_template_id": null, "is_original_content": false, "user_reports": [], "secure_media": null, "is_reddit_media_domain": true, "is_meta": false, "category": null, "secure_media_embed": {}, "link_flair_text": "Desktop", "can_mod_post": false, "score": 1248, "approved_by": null, "is_created_from_ads_ui": false, "author_premium": true, "thumbnail": "https://b.thumbs.redditmedia.com/9_Rj_TcnaiZ-2IQJILP6hKm1G4HAY9ksoS3qZMHkVZg.jpg", "edited": false, "author_flair_css_class": null, "author_flair_richtext": [], "gildings": {}, "post_hint": "image", "content_categories": null, "is_self": false, "mod_note": null, "created": 1621301120.0, "link_flair_type": "text", "wls": 0, "removed_by_category": null, "banned_by": null, "author_flair_type": "text", "domain": "i.redd.it", "allow_live_comments": false, "selftext_html": null, "likes": null, "suggested_sort": null, "banned_at_utc": null, "url_overridden_by_dest": "https://i.redd.it/2rybdzvgtpz61.jpg", "view_count": null, "archived": false, "no_follow": false, "is_crosspostable": false, "pinned": false, "over_18": false, "preview": {"images": [{"source": {"url": "https://preview.redd.it/2rybdzvgtpz61.jpg?auto=webp&s=1c6b3495b5d30102dcd954d7e3efa7f536b8c477", "width": 4000, "height": 2250}, "resolutions": [{"url": "https://preview.redd.it/2rybdzvgtpz61.jpg?width=108&crop=smart&auto=webp&s=11303d380eca005659774950953bc56cc71d8b0a", "width": 108, "height": 60}, {"url": "https://preview.redd.it/2rybdzvgtpz61.jpg?width=216&crop=smart&auto=webp&s=5f60361bcb18f1e80bd57bd6d25806054a0cf9a4", "width": 216, "height": 121}, {"url": "https://preview.redd.it/2rybdzvgtpz61.jpg?width=320&crop=smart&auto=webp&s=1dafe11934b0e63af3bb93e81b8c22152ed1ccbf", "width": 320, "height": 180}, {"url": "https://preview.redd.it/2rybdzvgtpz61.jpg?width=640&crop=smart&auto=webp&s=28fd2c607860e37dddb9429e88fc824b2378ee9c", "width": 640, "height": 360}, {"url": "https://preview.redd.it/2rybdzvgtpz61.jpg?width=960&crop=smart&auto=webp&s=c0bafa056746616a44064c699d9f35045ac69649", "width": 960, "height": 540}, {"url": "https://preview.redd.it/2rybdzvgtpz61.jpg?width=1080&crop=smart&auto=webp&s=331d6229b195b8908dc4e68aaa36af43313c8045", "width": 1080, "height": 607}], "variants": {}, "id": "HFyf7Odhag7nK_TgRgcWDUO0PDAN1K0ekPrsfvab3Zk"}], "enabled": true}, "all_awardings": [], "awarders": [], "media_only": false, "link_flair_template_id": "179a7c56-2bf0-11e5-8638-0ec07e44b9c3", "can_gild": false, "spoiler": false, "locked": false, "author_flair_text": null, "treatment_tags": [], "visited": false, "removed_by": null, "num_reports": null, "distinguished": null, "subreddit_id": "t5_2ss60", "mod_reason_by": null, "removal_reason": null, "link_flair_background_color": "#5bcb2b", "id": "nem8uj", "is_robot_indexable": true, "report_reasons": null, "author": "its_CheeChung", "discussion_type": null, "num_comments": 14, "send_replies": true, "whitelist_status": "no_ads", "contest_mode": false, "mod_reports": [], "author_patreon_flair": false, "author_flair_text_color": null, "permalink": "/r/Animewallpaper/comments/nem8uj/maisan_in_pajamas_seishun_buta_yarou_40002250/", "parent_whitelist_status": "no_ads", "stickied": false, "url": "https://i.redd.it/2rybdzvgtpz61.jpg", "subreddit_subscribers": 201905, "created_utc": 1621272320.0, "num_crossposts": 1, "media": null, "is_video": false}}, {"kind": "t3", "data": {"approved_at_utc": null, "subreddit": "Animewallpaper", "selftext": "", "author_fullname": "t2_1ir8hy35", "saved": false, "mod_reason_title": null, "gilded": 0, "clicked": false, "title": "Yanfei & Eula [Genshin Impact] (3840x2160)", "link_flair_richtext": [], "subreddit_name_prefixed": "r/Animewallpaper", "hidden": false, "pwls": 0, "link_flair_css_class": "two", "downs": 0, "thumbnail_height": 78, "top_awarded_type": null, "hide_score": false, "name": "t3_neb5z9", "quarantine": false, "link_flair_text_color": "dark", "upvote_ratio": 0.99, "author_flair_background_color": "", "subreddit_type": "public", "ups": 849, "total_awards_received": 3, "media_embed": {}, "thumbnail_width": 140, "author_flaLine truncated
+12 -2
View File
@@ -1,10 +1,14 @@
#!/usr/bin/env bash
link="https://source.unsplash.com/random/"
# https://www.reddit.com/r/Animewallpaper/search/.json?q=flair_name%3ADesktop&restrict_sr=1
reddit(){
useragent="thevinter"
timeout=60
readarray subreddits < subreddits
a=${#subreddits[@]}
b=$(($RANDOM % $a))
sub=${subreddits[$b]}
@@ -21,9 +25,15 @@ reddit(){
if [ ! -z $1 ]; then
sub=$1
fi
url="https://www.reddit.com/r/$sub/$sort/.json?raw_json=1&t=$top_time"
# url="https://www.reddit.com/r/$sub/$sort/.json?raw_json=1&t=$top_time"
url="https://www.reddit.com/r/$sub/search/.json?q=flair_name%3ADesktop&restrict_sr=1"
# echo $url
# exit
content=`wget -T $timeout -U "$useragent" -q -O - $url`
urls=$(echo -n "$content"| jq -r '.data.children[]|select(.data.post_hint|test("image")?) | .data.preview.images[0].source.url')
# echo $content
# exit
# urls=$(echo -n "$content"| jq -r '.data.children[]|select(.data.post_hint|test("image")?) | .data.preview.images[0].source.url')
urls=$(echo -n "$content"| jq -r '.data.children[]|select(.data.post_hint|test("image")?) | .data.url')
names=$(echo -n "$content"| jq -r '.data.children[]|select(.data.post_hint|test("image")?) | .data.title')
ids=$(echo -n "$content"| jq -r '.data.children[]|select(.data.post_hint|test("image")?) | .data.id')
arrURLS=($urls)
+1 -5
View File
@@ -1,5 +1 @@
wallpapers
earthporn
spaceporn
wallpaper
pic
Animewallpaper