diff --git a/main.py b/main.py index e2aef86..b84e6f7 100755 --- a/main.py +++ b/main.py @@ -386,28 +386,6 @@ def has_content_image(images: list[dict]) -> bool: return False -def get_wikipedia_extract(title: str) -> str: - """Get the first paragraph extract of a Wikipedia article.""" - params = { - "action": "query", - "prop": "extracts", - "exintro": "true", - "explaintext": "true", - "titles": title, - "format": "json", - } - headers = {"User-Agent": WIKIMEDIA_USER_AGENT} - try: - r = requests.get(WIKIPEDIA_API, params=params, headers=headers) - data = r.json() - pages = data.get("query", {}).get("pages", {}) - for page in pages.values(): - return page.get("extract", "") - except Exception: - pass - return "" - - def get_articles_without_images( category: str, limit: int = 200, @@ -752,8 +730,6 @@ def start() -> str: flickr_search = f'"{without_middle}"' search_result = search_flickr(flickr_search, page) - wikipedia_extract = get_wikipedia_extract(wiki_part2) - return flask.render_template( "combined.html", name=name, @@ -761,7 +737,6 @@ def start() -> str: search_result=search_result, cat=cat, flickr_search=flickr_search, - wikipedia_extract=wikipedia_extract, ) if "/in/" in flickr_url: diff --git a/templates/combined.html b/templates/combined.html index 1f4ee7f..394327b 100644 --- a/templates/combined.html +++ b/templates/combined.html @@ -63,7 +63,6 @@
{% endif %}Wikipedia article: {{ name }}
- {% if wikipedia_extract %}{{ wikipedia_extract }}
{% endif %}