267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287 | break
# convert
r = []
for row in (ls["data"] for ls in data):
# find links in text posts
text_urls = re.findall("\]\((https?://(?:www\.)?youtu[^\"\'\]\)]+)", row.get("selftext", ""))
url_ext = (re.findall("\.(\w+)(?:$|[?&])", row["url"]) or [""])[0].lower()
listformat = "href"
state = "gtk-media-play"
# Youtube URLs
if re.search("youtu\.?be|vimeo|dailymotion", row["url"]):
format = "video/youtube"
listformat = "srv"
# direct MP3/Ogg
elif url_ext in ("mp3", "ogg", "flac", "aac", "aacp", "mid", "midi"):
format = "audio/" + url_ext
listformat = "srv"
# playlists? |
|
|
| 267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287 | break
# convert
r = []
for row in (ls["data"] for ls in data):
# find links in text posts
text_urls = re.findall("\]\((https?://(?:www\.)?(youtu|peertu)[^\"\'\]\)]+)", row.get("selftext", ""))
url_ext = (re.findall("\.(\w+)(?:$|[?&])", row["url"]) or [""])[0].lower()
listformat = "href"
state = "gtk-media-play"
# Youtube URLs
if re.search("youtu\.?be|vimeo|dailymotion|peertube", row["url"]):
format = "video/youtube"
listformat = "srv"
# direct MP3/Ogg
elif url_ext in ("mp3", "ogg", "flac", "aac", "aacp", "mid", "midi"):
format = "audio/" + url_ext
listformat = "srv"
# playlists? |