Debian Codegraph @

gallery_dl/extractor/xenforo.py

raw
1 # -*- coding: utf-8 -*-
2
3 # Copyright 2025-2026 Mike Fährmann
4 #
5 # This program is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License version 2 as
7 # published by the Free Software Foundation.
8
9 """Extractors for XenForo forums"""
10
11 from .common import BaseExtractor, Message
12 from .. import text, util
13
14
15 class XenforoExtractor(BaseExtractor):
16 """Base class for xenforo extractors"""
17 basecategory = "xenforo"
18 directory_fmt = ("{category}", "{thread[section]}",
19 "{thread[title]} ({thread[id]})")
20 filename_fmt = "{post[id]}_{num:>02}{id:?_//}_{filename}.{extension}"
21 archive_fmt = "{post[id]}/{type[0]}{id}_{filename}"
22
23 def __init__(self, match):
24 BaseExtractor.__init__(self, match)
25 self.cookies_domain = self.root.split("/")[2]
26 self.cookies_names = self.config_instance("cookies") or ("xf_user",)
27
28 def items(self):
29 self.login()
30
31 extract_urls = text.re(
32 r'(?s)(?:'
33 r'<video (.*?\ssrc="[^"]+".*?)</video>'
34 r'|<a [^>]*?'
35 r'href="([^"]*?/(?:index\.php\?)?attachments/[^"]+".*?)</a>'
36 r'|<div class="bb(?:Image|Media)Wrapper[^>]*?'
37 r'data-src="([^"]+".*?) />'
38 r'|(?:<a [^>]*?href="|<iframe [^>]*?src="|'
39 r'''onclick="loadMedia\(this, ')([^"']+[^<]*?<)'''
40 r')'
41 ).findall
42
43 embeds = self.config("embeds", True)
44 quotes = self.config("quoted", False)
45 attachments = self.config("attachments", True)
46
47 root = self.root
48 base = root if (pos := root.find("/", 8)) < 0 else root[:pos]
49 for post in self.posts():
50 content = post["content"]
51 if not quotes:
52 content = self._remove_quotes(content)
53
54 urls = extract_urls(content)
55 if embeds and "data-s9e-mediaembed-iframe=" in content:
56 self._extract_embeds(urls, post, content)
57 if attachments and post["attachments"]:
58 self._extract_attachments(urls, post)
59
60 data = {"post": post}
61 post["count"] = data["count"] = len(urls)
62 yield Message.Directory, "", data
63
64 id_last = None
65 data["_http_expected_status"] = (403,)
66 data["_http_validate"] = self._validate
67 data["num"] = data["num_internal"] = data["num_external"] = 0
68 for video, inl, bb, ext in urls:
69 if ext:
70 if ext[0] == "#":
71 continue
72 if ext[0] == "/":
73 if ext[1] == "/":
74 if "'" in ext:
75 ext = ext[:ext.find("'")]
76 ext = "https:" + ext
77 elif ext.startswith("/goto/link-confirmation?"):
78 params = text.parse_query(text.unescape(ext[24:]))
79 ext = self._b64decode(params["url"])
80 elif ext.startswith("/redirect/"):
81 if to := text.extr(ext, "?to=", "&"):
82 ext = self._b64decode(to)
83 elif html := text.extr(ext, ">", "<").strip():
84 ext = text.unescape(html)
85 else:
86 continue
87 elif '"' in ext:
88 ext = ext[:ext.find('"')]
89 if ext.startswith("https://anonym.es/?"):
90 ext = text.unquote(ext[19:])
91 data["num"] += 1
92 data["num_external"] += 1
93 data["type"] = "external"
94 yield Message.Queue, ext, data
95
96 elif video:
97 data["num"] += 1
98 data["num_internal"] += 1
99 data["type"] = "video"
100 url = text.extr(video, 'src="', '"')
101 text.nameext_from_url(url, data)
102 data["id"] = text.parse_int(
103 data["filename"].partition("-")[0])
104 if url[0] == "/":
105 url = base + url
106 yield Message.Url, url, data
107
108 elif (inline := bb or inl):
109 url = inline[:inline.find('"')]
110 name, _, id = url[url.rfind("/", 0, -1):].strip(
111 "/").rpartition(".")
112 data["id"] = id = text.parse_int(id)
113 if id:
114 if id == id_last:
115 id_last = None
116 continue
117 else:
118 id_last = id
119 if alt := (text.extr(inline, 'alt="', '"') or
120 text.extr(inline, 'title="', '"')):
121 text.nameext_from_name(alt, data)
122 if not data["extension"]:
123 data["extension"] = name.rpartition("-")[2]
124 else:
125 data["filename"], _, data["extension"] = \
126 name.rpartition("-")
127 data["num"] += 1
128 data["num_internal"] += 1
129 data["type"] = "inline"
130 if url[0] == "/":
131 url = base + url
132 yield Message.Url, url, data
133
134 def items_media(self, path, pnum, callback=None):
135 if (order := self.config("order-posts")) and \
136 order[0] in {"d", "r"}:
137 pages = self._pagination_reverse(path, pnum, callback)
138 reverse = True
139 else:
140 pages = self._pagination(path, pnum, callback)
141 reverse = False
142
143 if self.config("metadata"):
144 extr_media = self._extract_media_ex
145 meta = True
146 else:
147 extr_media = self._extract_media
148 meta = False
149
150 root = self.root
151 base = root if (pos := root.find("/", 8)) < 0 else root[:pos]
152 for page in pages:
153 posts = page.split(
154 '<div class="itemList-item js-inlineModContainer')
155 del posts[0]
156
157 if reverse:
158 posts.reverse()
159
160 for html in posts:
161 href, pos = text.extract(html, 'href="', '"')
162 name, pos = text.extract(html, "alt='", "'", pos)
163
164 url, media = extr_media(
165 base + href, href[href.rfind("/", 0, -1)+1:-1])
166 if url.endswith("/register/full"):
167 self._warn_auth()
168 continue
169 if not meta and name:
170 text.nameext_from_name(text.unescape(name), media)
171
172 yield Message.Directory, "", media
173 yield Message.Url, url, media
174
175 def request_page(self, url):
176 try:
177 response = self.request(url)
178 if response.history and response.url.endswith("/register"):
179 self._require_auth(response)
180 return response
181 except self.exc.HttpError as exc:
182 if exc.status == 403 and b">Log in<" in exc.response.content:
183 self._require_auth(exc.response)
184 raise
185
186 def login(self):
187 if self.cookies_names and self.cookies_check(
188 self.cookies_names, subdomains=True):
189 return
190
191 username, password = self._get_auth_info()
192 if username:
193 return self.cookies_update(self.cache(
194 self._login_impl, username, password,
195 _exp=365*86400, _mem=False))
196
197 def _login_impl(self, username, password):
198 self.log.info("Logging in as %s", username)
199
200 url = self.root + "/login/login"
201 page = self.request(url).text
202 data = {
203 "_xfToken": text.extr(page, 'name="_xfToken" value="', '"'),
204 "login" : username,
205 "password": password,
206 "remember": "1",
207 "_xfRedirect": "",
208 }
209 response = self.request(url, method="POST", data=data)
210
211 if not response.history:
212 err = self._extract_error(response.text)
213 err = f'"{err}"' if err else None
214 raise self.exc.AuthenticationError(err)
215
216 return {
217 cookie.name: cookie.value
218 for cookie in self.cookies
219 if cookie.domain.endswith(self.cookies_domain)
220 }
221
222 def _pagination(self, base, pnum=None, callback=None, params=""):
223 base = self.root + base
224
225 if pnum is None:
226 url = f"{base}/{params}"
227 pnum = 1
228 else:
229 url = f"{base}/page-{pnum}{params}"
230 pnum = None
231
232 page = self.request_page(url).text
233 if callback is not None:
234 callback(page)
235 while True:
236 yield page
237
238 if pnum is None or "pageNav-jump--next" not in page:
239 return
240 pnum += 1
241 page = self.request_page(f"{base}/page-{pnum}{params}").text
242
243 def _pagination_reverse(self, base, pnum=None, callback=None):
244 base = self.root + base
245
246 url = f"{base}/page-{'9999' if pnum is None else pnum}"
247 with self.request_page(url) as response:
248 if pnum is None and not response.history:
249 self._require_auth()
250 url = response.url
251 if url[-1] == "/":
252 pnum = 1
253 else:
254 pnum = text.parse_int(url[url.rfind("-")+1:], 1)
255 page = response.text
256
257 if callback is not None:
258 callback(page)
259 while True:
260 yield page
261
262 pnum -= 1
263 if pnum > 1:
264 url = f"{base}/page-{pnum}"
265 elif pnum == 1:
266 url = base + "/"
267 else:
268 return
269
270 page = self.request_page(url).text
271
272 def _remove_quotes(self, content):
273 while "<blockquote" in content:
274 beg = content.index("<blockquote")
275 end = content.index("</blockquote", beg)
276 for _ in range(content.count("<blockquote", beg+11, end)):
277 end = content.index("</blockquote", end+13)
278 content = content[:beg] + content[end+13:]
279 return content
280
281 def _b64decode(self, value):
282 return util.b64decode(value.replace("-", "+").replace("_", "/") + "==")
283
284 def _extract_error(self, html):
285 if msg := (text.extr(html, "blockMessage--error", "</") or
286 text.extr(html, '"blockMessage"', "</div>")):
287 return text.unescape(msg[msg.find(">")+1:].strip())
288
289 def _parse_post(self, html):
290 extr = text.extract_from(html)
291
292 post = {
293 "author": extr('data-author="', '"'),
294 "id": (extr('data-content="post-', '"') or
295 extr('data-content="profile-post-', '"')),
296 "author_url": (extr('itemprop="url" content="', '"') or
297 extr('<a href="', '"')),
298 "date": self.parse_datetime_iso(extr('datetime="', '"')),
299 "content": (extr('class="message-body',
300 '<div class="js-selectToQuote') or
301 extr('class="message-body',
302 '</article>')),
303 "attachments": extr('<section class="message-attachments">',
304 '</section>'),
305 }
306
307 url_a = post["author_url"]
308 post["author_slug"], _, post["author_id"] = \
309 url_a[url_a.rfind("/", 0, -1)+1:-1].rpartition(".")
310
311 con = post["content"]
312 if (pos := con.find('<div class="bbWrapper')) >= 0:
313 con = con[pos:]
314 post["content"] = con.strip()
315
316 return post
317
318 def _parse_thread(self, page):
319 try:
320 data = self._extract_jsonld(page)
321 except ValueError:
322 return {}
323
324 path = text.split_html(text.extr(
325 page, 'class="p-breadcrumbs', "</ul>"))
326 del path[0]
327
328 main = data.get("mainEntity", data)
329 url = main.get("url") or main.get("@id") or ""
330
331 self.kwdict["thread"] = thread = self._parse_author(main["author"], {
332 "id" : url[url.rfind(".")+1:-1],
333 "url" : url,
334 "title": main["headline"],
335 "date" : self.parse_datetime_iso(main["datePublished"]),
336 "tags" : (main["keywords"].split(", ")
337 if "keywords" in main else ()),
338 "section": main["articleSection"],
339 "path" : path,
340 })
341
342 stats = main["interactionStatistic"]
343 if isinstance(stats, list):
344 thread["views"] = stats[0]["userInteractionCount"]
345 thread["posts"] = stats[1]["userInteractionCount"]
346 else:
347 thread["views"] = -1
348 thread["posts"] = stats["userInteractionCount"]
349
350 return thread
351
352 def _parse_album(self, page):
353 main = self._extract_jsonld(page)["mainEntity"]
354 url = main.get("url") or main.get("@id") or ""
355 slug, _, id = url[url.rfind("/", 0, -1)+1:-1].rpartition(".")
356
357 self.kwdict["album"] = album = self._parse_author(main["author"], {
358 "id" : id,
359 "url" : url,
360 "slug" : text.unquote(slug),
361 "title": main["headline"],
362 "description": main.get("description"),
363 "date": self.parse_datetime_iso(main["dateCreated"]),
364 })
365
366 stats = main["interactionStatistic"]
367 if isinstance(stats, list):
368 album["count"] = stats[0]["userInteractionCount"]
369 album["likes"] = stats[1]["userInteractionCount"]
370 album["views"] = stats[2]["userInteractionCount"]
371 album["comments"] = stats[3]["userInteractionCount"]
372
373 return album
374
375 def _parse_profile(self, page):
376 user = self._extract_jsonld(page)
377 main = user["mainEntity"]
378 url = user.get("url") or main.get("@id") or ""
379 slug, _, id = url[url.rfind("/", 0, -1)+1:-1].rpartition(".")
380
381 self.kwdict["profile"] = profile = {
382 "id" : main.get("identifier") or id,
383 "url" : url,
384 "slug" : text.unquote(slug),
385 "name" : main.get("name"),
386 "avatar": main.get("image"),
387 "description": main.get("description"),
388 "date" : self.parse_datetime_iso(user.get("dateCreated")),
389 }
390
391 stats = main.get("interactionStatistic")
392 if isinstance(stats, list):
393 profile["follows"] = stats[0]["userInteractionCount"]
394 profile["likes"] = stats[1]["userInteractionCount"]
395
396 return profile
397
398 def _parse_author(self, author, data):
399 data["author"] = author.get("name") or ""
400 if url := author.get("url"):
401 data["author_url"] = url
402 data["author_slug"], _, data["author_id"] = \
403 url[url.rfind("/", 0, -1)+1:-1].rpartition(".")
404 else:
405 data["author_url"] = ""
406 data["author_slug"] = text.slugify(data["author"][:15])
407 data["author_id"] = data["author"][15:]
408 return data
409
410 def _extract_attachments(self, urls, post):
411 find = text.re(r"(?s)\shref=[\"'](.+)").search
412 for att in text.extract_iter(post["attachments"], "<li", "</li>"):
413 urls.append((None, find(att)[1], None, None))
414
415 def _extract_embeds(self, urls, post, content):
416 for embed in text.extract_iter(
417 content, "data-s9e-mediaembed-iframe='", "'"):
418 data = {}
419 key = None
420 for value in util.json_loads(embed):
421 if key is None:
422 key = value
423 else:
424 data[key] = value
425 key = None
426
427 src = data.get("src")
428 if not src:
429 self.log.debug(data)
430 continue
431
432 type = data.get("data-s9e-mediaembed")
433 frag = src[src.find("#")+1:]
434 if type == "tiktok":
435 url = "https://www.tiktok.com/@/video/" + frag
436 elif type == "reddit":
437 url = "https://embed.reddit.com/r/" + frag
438 elif type == "imgur":
439 url = "https://imgur.com/" + frag
440 else:
441 self.log.warning("%s: Unsupported media embed type '%s'",
442 post["id"], type)
443 continue
444 urls.append((None, None, None, url))
445
446 def _extract_media(self, url, file):
447 media = {}
448 name, _, media["id"] = file.rpartition(".")
449 media["filename"], _, media["extension"] = name.rpartition("-")
450 return url + "full", media
451
452 def _extract_media_ex(self, url, file):
453 page = self.request_page(url).text
454
455 schema = self._extract_jsonld(page)
456 main = schema["mainEntity"]
457 stats = main["interactionStatistic"]
458
459 media = text.nameext_from_name(main["name"], {
460 "schema": schema,
461 "id" : file.rpartition(".")[2],
462 "size" : main.get("contentSize"),
463 "description": main.get("description"),
464 "date" : self.parse_datetime_iso(main.get("dateCreated")),
465 "width" : (w := main.get("width")) and text.parse_int(
466 w["name"].partition(" ")[0]) or 0,
467 "height": (h := main.get("height")) and text.parse_int(
468 h["name"].partition(" ")[0]) or 0,
469 })
470
471 self._parse_author(main["author"], media)
472 if ext := main.get("encodingFormat"):
473 media["extension"] = ext
474
475 if isinstance(stats, list):
476 media["views"] = stats[0]["userInteractionCount"]
477 media["likes"] = stats[1]["userInteractionCount"]
478 media["comments"] = stats[2]["userInteractionCount"]
479
480 return main["contentUrl"], media
481
482 def _require_auth(self, response=None):
483 raise self.exc.AuthRequired(
484 ("username & password", "authenticated cookies"), None,
485 None if response is None else self._extract_error(response.text))
486
487 def _warn_auth(self):
488 try:
489 self._require_auth()
490 except Exception as exc:
491 self.log.warning(exc)
492
493 def _validate(self, response):
494 if response.status_code == 403 and b">Log in<" in response.content:
495 self._require_auth(response)
496 return True
497
498
499 BASE_PATTERN = XenforoExtractor.update({
500 "simpcity": {
501 "root": "https://simpcity.cr",
502 "pattern": r"(?:www\.)?simpcity\.(?:cr|su)",
503 "cookies": ("ogaddgmetaprof_user",),
504 },
505 "nudostarforum": {
506 "root": "https://nudostar.com/forum",
507 "pattern": r"(?:www\.)?nudostar\.com/forum",
508 },
509 "atfforum": {
510 "root": "https://allthefallen.moe/forum",
511 "pattern": r"(?:www\.)?allthefallen\.moe/forum",
512 },
513 "celebforum": {
514 "root": "https://celebforum.cc",
515 "pattern": r"(?:www\.)?celebforum\.(?:cc|to)",
516 },
517 "titsintops": {
518 "root": "https://titsintops.com/phpBB2",
519 "pattern": r"(?:www\.)?titsintops\.com/phpBB2",
520 },
521 "socialmediagirlsforum": {
522 "root": "https://forums.socialmediagirls.com",
523 "pattern": r"forums\.socialmediagirls\.com",
524 },
525 "blacktowhite": {
526 "root": "https://www.blacktowhite.net",
527 "pattern": r"(?:www\.)?blacktowhite\.net",
528 },
529 "thefappeningforum": {
530 "root": "https://thefappeningblog.com/forum",
531 "pattern": r"(?:www\.)?thefappeningblog\.com/forum",
532 },
533 "thirsthub": {
534 "root": "https://thirsthub.cc",
535 "pattern": r"thirsthub\.cc",
536 },
537 })
538
539
540 class XenforoPostExtractor(XenforoExtractor):
541 subcategory = "post"
542 pattern = (BASE_PATTERN + r"(/(?:index\.php\?)?threads"
543 r"/[^/?#]+/(?:page-\d+)?#?post-|/posts/)(\d+)")
544 example = "https://simpcity.cr/threads/TITLE.12345/post-54321"
545
546 def posts(self):
547 path = self.groups[-2]
548 post_id = self.groups[-1]
549 url = f"{self.root}{path}{post_id}/"
550 page = self.request_page(url).text
551
552 pos = page.find(f'data-content="post-{post_id}"')
553 if pos < 0:
554 raise self.exc.NotFoundError("post")
555 html = text.extract(page, "<article ", "<footer", pos-200)[0]
556
557 self._parse_thread(page)
558 return (self._parse_post(html),)
559
560
561 class XenforoThreadExtractor(XenforoExtractor):
562 subcategory = "thread"
563 pattern = (BASE_PATTERN + r"(/(?:index\.php\?)?threads"
564 r"/(?:[^/?#]+\.)?\d+)(?:/page-(\d+))?")
565 example = "https://simpcity.cr/threads/TITLE.12345/"
566
567 def posts(self):
568 path = self.groups[-2]
569 pnum = self.groups[-1]
570
571 if (order := self.config("order-posts")) and \
572 order[0] not in {"d", "r"}:
573 params = "?order=reaction_score" if order[0] == "s" else ""
574 pages = self._pagination(path, pnum, params=params)
575 reverse = False
576 elif order == "reaction":
577 pages = self._pagination(
578 path, pnum, params="?order=reaction_score")
579 reverse = False
580 else:
581 pages = self._pagination_reverse(path, pnum)
582 reverse = True
583
584 for page in pages:
585 if "thread" not in self.kwdict:
586 self._parse_thread(page)
587 posts = text.extract_iter(page, "<article ", "<footer")
588 if reverse:
589 posts = list(posts)
590 posts.reverse()
591 for html in posts:
592 yield self._parse_post(html)
593
594
595 class XenforoForumExtractor(XenforoExtractor):
596 subcategory = "forum"
597 pattern = (BASE_PATTERN + r"(/(?:index\.php\?)?forums"
598 r"/(?:[^/?#]+\.)?[^/?#]+)(?:/page-(\d+))?")
599 example = "https://simpcity.cr/forums/TITLE.123/"
600
601 def items(self):
602 extract_threads = text.re(
603 r'(/(?:index\.php\?)?threads/[^"]+)"[^>]+data-xf-init=').findall
604
605 data = {"_extractor": XenforoThreadExtractor}
606 path = self.groups[-2]
607 pnum = self.groups[-1]
608 for page in self._pagination(path, pnum):
609 for path in extract_threads(page):
610 yield Message.Queue, self.root + text.unquote(path), data
611
612
613 class XenforoMediaUserExtractor(XenforoExtractor):
614 subcategory = "media-user"
615 directory_fmt = ("{category}", "Media", "{author_slug}")
616 filename_fmt = "{filename}.{extension}"
617 archive_fmt = "{id}"
618 pattern = (BASE_PATTERN + r"(/(?:index\.php\?)?)me(?:"
619 r"dia/users/([^/?#]+)(?:/page-(\d+))?|"
620 r"mbers/([^/?#]+)/#xfmgMedia)")
621 example = "https://simpcity.cr/media/users/USER.123/"
622
623 def items(self):
624 groups = self.groups
625
626 user = groups[-3]
627 if user is None:
628 user = groups[-1]
629 pnum = None
630 else:
631 pnum = groups[-2]
632
633 if not self.config("metadata"):
634 self.kwdict["author_slug"], _, self.kwdict["author_id"] = \
635 user.rpartition(".")
636
637 return self.items_media(f"{groups[-4]}media/users/{user}", pnum)
638
639
640 class XenforoMediaAlbumExtractor(XenforoExtractor):
641 subcategory = "media-album"
642 directory_fmt = ("{category}", "Media", "Albums",
643 "{album[slug]} ({album[id]})")
644 filename_fmt = "{filename}.{extension}"
645 archive_fmt = "{id}"
646 pattern = (BASE_PATTERN + r"(/(?:index\.php\?)?"
647 r"media/albums/([^/?#]+))(?:/page-(\d+))?")
648 example = "https://simpcity.cr/media/albums/ALBUM.123/"
649
650 def items(self):
651 return self.items_media(
652 self.groups[-3], self.groups[-1], self._parse_album)
653
654
655 class XenforoMediaCategoryExtractor(XenforoExtractor):
656 subcategory = "media-category"
657 directory_fmt = ("{category}", "Media", "Category", "{mcategory}")
658 filename_fmt = "{filename}.{extension}"
659 archive_fmt = "{id}"
660 pattern = (BASE_PATTERN + r"(/(?:index\.php\?)?"
661 r"media/categories/([^/?#]+))(?:/page-(\d+))?")
662 example = "https://simpcity.cr/media/categories/CATEGORY.123/"
663
664 def items(self):
665 self.kwdict["mcategory"], _, self.kwdict["mcategory_id"] = \
666 self.groups[-2].rpartition(".")
667 return self.items_media(self.groups[-3], self.groups[-1])
668
669
670 class XenforoMediaItemExtractor(XenforoExtractor):
671 subcategory = "media-item"
672 directory_fmt = ("{category}", "Media", "{author_slug|''}")
673 filename_fmt = "{filename}.{extension}"
674 archive_fmt = "{id}"
675 pattern = BASE_PATTERN + r"(/(?:index\.php\?)?media/((?:[^/?#]+\.)\d+))"
676 example = "https://simpcity.cr/media/NAME.123/"
677
678 def items(self):
679 url = f"{self.root}{self.groups[-2]}/"
680 url, media = (self._extract_media_ex if self.config("metadata") else
681 self._extract_media)(url, self.groups[-1])
682 yield Message.Directory, "", media
683 yield Message.Url, url, media
684
685
686 class XenforoProfileExtractor(XenforoExtractor):
687 subcategory = "profile"
688 directory_fmt = ("{category}", "Profiles", "{profile[name]}")
689 archive_fmt = "{id}"
690 pattern = (BASE_PATTERN + r"(/(?:index\.php\?)?"
691 r"members/[^/?#]+)(?:/page-(\d+))?")
692 example = "https://simpcity.cr/members/USER.123/"
693
694 def posts(self):
695 path = self.groups[-2]
696 pnum = self.groups[-1]
697
698 if (order := self.config("order-posts")) and \
699 order[0] in {"d", "r"}:
700 pages = self._pagination_reverse(path, pnum)
701 reverse = True
702 else:
703 pages = self._pagination(path, pnum)
704 reverse = False
705
706 for page in pages:
707 if "profile" not in self.kwdict:
708 self._parse_profile(page)
709 posts = text.extract_iter(page, "<article ", "<footer")
710 if reverse:
711 posts = list(posts)
712 posts.reverse()
713 for html in posts:
714 yield self._parse_post(html)