{"id":21569344,"url":"https://github.com/aweirddev/yahoo-search","last_synced_at":"2025-08-25T16:10:31.641Z","repository":{"id":198971665,"uuid":"701653893","full_name":"AWeirdDev/yahoo-search","owner":"AWeirdDev","description":"Search anything on Yahoo: web pages, news, videos \u0026 images, autocomplete, and more.","archived":false,"fork":false,"pushed_at":"2023-10-08T04:28:00.000Z","size":23,"stargazers_count":3,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-24T12:47:54.051Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/AWeirdDev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-10-07T07:08:38.000Z","updated_at":"2024-08-26T16:13:54.000Z","dependencies_parsed_at":null,"dependency_job_id":"6ee023e4-f945-43a6-ae19-814818c4d12f","html_url":"https://github.com/AWeirdDev/yahoo-search","commit_stats":null,"previous_names":["aweirdscratcher/yahoo-search","aweirddev/yahoo-search"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AWeirdDev%2Fyahoo-search","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AWeirdDev%2Fyahoo-search/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AWeirdDev%2Fyahoo-search/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AWeirdDev%2Fyahoo-search/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AWeirdDev","download_url":"https://codeload.github.com/AWeirdDev/yahoo-search/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248231944,"owners_count":21069428,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-24T11:09:13.122Z","updated_at":"2025-04-10T14:07:13.270Z","avatar_url":"https://github.com/AWeirdDev.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# yahoo-search\n\n![GitHub issues](https://img.shields.io/github/issues/AWeirdScratcher/yahoo-search?style=for-the-badge\u0026logo=github)\n![PyPI - License](https://img.shields.io/pypi/l/yahoo-search-py?style=for-the-badge\u0026logo=pypi\u0026logoColor=white)\n\nSearch anything on Yahoo: web pages, news, videos, autocomplete, and weather.\n\n```shell\n$ pip install yahoo-search-py\n```\n\n## Simple API\n\nSimple and Pythonic API with Pydantic.\n\nGet almost every result: `also_try`, `pages`, `card`, and `related_searches`.\n\n```python\nfrom yahoo_search import search\n\nresult = search(\"chocolate\")\nprint(result.pages[0])\n```\n\n\u003cdetails\u003e\n    \u003csummary\u003eSee Example Output\u003c/summary\u003e\n\n```python\nPageResult(\n    title='Chocolate - Wikipedia',\n    link='https://en.wikipedia.org/wiki/Chocolate',\n    text='A \"cocoa product\" is defined as a food product that is sourced from cocoa beans and contains \"cocoa nibs, cocoa liquor, cocoa mass, unsweetened chocolate, bitter chocolate, chocolate liquor, cocoa, low-fat cocoa, cocoa powder, or low-fat cocoa powder\". Conching. Main article: Conching.'\n)\n```\n\n\u003c/details\u003e\n\n## Yahoo News Search\n\nYou can also search news with ease.\n\n```python\nfrom yahoo_search import search_news\n\nresult = search_news(\"taiwan\")\nprint(result.news[0])\n```\n\n\u003cdetails\u003e\n    \u003csummary\u003eSee Example Output\u003c/summary\u003e\n\n```python\nNews(\n    title='How to take the Taiwan Design Expo personality test that\\'s trending on IG Stories',\n    thumbnail='https://s.yimg.com/fz/api/res/1.2/(...)',\n    source='Lifestyle Asia via Yahoo Style Singapore',\n    text='If you\\'ve always wanted to know your personality type beyond the conventional MBTI variants, it\\'s...'\n)\n```\n\n\u003c/details\u003e\n\n## Yahoo Videos Search\n\nSearch and preview online videos easily.\n\n```python\nfrom yahoo_search import search_videos\n\nresult = search_videos(\"jvke - golden hour\")\nprint(result.videos[0].video_preview)\n```\n\n\u003cdetails\u003e\n    \u003csummary\u003eSee Example Output\u003c/summary\u003e\n\n```\nhttps://tse3.mm.bing.net/th?id=OM.7UQt_nfsv8nF0A_1687237113\u0026pid=Api\n```\n\n\u003c/details\u003e\n\n## Yahoo Weather\n\nGet the weather, because why not.\n\n```python\nfrom yahoo_search import weather\n\nw = weather()\nprint(w.celsius)\nprint(w.forecast[\"Monday\"])\n```\n\n\u003cdetails\u003e\n    \u003csummary\u003eSee Example Output\u003c/summary\u003e\n\n```python\n30\nWeatherForecast(\n    fahrenheit=HighLowTemperature(\n        highest=92,\n        lowest=78\n    ),\n    celsius=HighLowTemperature(\n        highest=34,\n        lowest=26\n    ),\n    weather=WeatherForecastInner(\n        text='Haze',\n        icon='https://s.yimg.com/g/images/spaceball.gif'\n    ),\n    precipitation=Precipitation(\n        icon='https://s.yimg.com/g/images/spaceball.gif',\n        percentage='0%'\n    )\n)\n```\n\n\u003c/details\u003e\n\n## Yahoo Autocomplete\n\nYou can add autocompletes to your applications.\n\n```python\nfrom yahoo_search import autocomplete\n\nprint(autocomplete(\"hello\"))\n```\n\n\u003cdetails\u003e\n    \u003csummary\u003eSee Example Output\u003c/summary\u003e\n\n```python\n[\"hello fresh\", \"hello kitty\", \"hello molly\", \"hello neighbor\", \"hello october\", \"hello fresh log in to my account\", \"hello october images\", \"hello kitty coloring pages\", \"hello magazine\", \"hellosign\"]\n```\n\n\u003c/details\u003e\n\n## Examples\n\nBelow are some simple examples (and inspirations):\n\n### Simple App — Yahoo Search\n\nBelow is a simple app that implements Yahoo searching right in your terminal.\n\n```python\nfrom yahoo_search import search\n\nwhile True:\n    query = input(\"search: \")\n    result = search(query)\n\n    if result.card:\n        # if there's a wikipedia definition\n        print(\"meaning\", result.card.heading)\n        print(result.card.text)\n\n    for page in result.pages:\n        print(page.title, page.link)\n        print(page.text)\n\n    for search in result.related_searches:\n        print(\"related search: \", search.text)\n```\n\n## Minutely News — Yahoo News\n\nTired of \"hourly\" or \"daily\" news? Try minutely, and let them fill into your mind... full of news.\n\n```python\nimport time\n\nfrom yahoo_search import search_news\n\nkeywords = (\"news\", \"taiwan\", \"usa\", \"chocolate\")\ncurrent = 0\n\nwhile True:\n    result = search_news(keywords[current])\n    for news in result.news:\n        print(news.title)\n        print(news.text)\n        print()\n\n    # loop through the keywords\n    current += 1\n    current %= len(keywords)\n\n    time.sleep(60)\n```\n\n## Video Previewer API — Yahoo Videos\n\nWe love public APIs, so let's make our own.\n\n```python\nimport fastapi\nfrom yahoo_search import search_videos\n\napp = fastapi.FastAPI()\n\n@app.get(\"/preview\")\ndef preview_video(query: str):\n    # takes the URL param\n    res = search_videos(query)\n    return {\n        \"url\": res.videos[0].video_preview\n    }\n```\n## Weather Forecast App — Yahoo Weather\n\nNawh, I ain't gonna setup a whole Flask app for this 💀💀\n\nTerminal app is enough.\n\n```python\nfrom yahoo_search import weather\n\nres = weather()\n\nprint(\"Forecast\")\n\nfor day, forecast in res.forecast.items():\n    print(\n        day,\n        \"-\", \n        forecast.weather.text,\n        forecast.precipitation.percentage,\n        forecast.fahrenheit.highest,\n        \"/\",\n        forecast.fahrenheit.lowest\n    )\n```\n\n## Extra: Async\n\nIf you're working with coroutines, such as Discord bots or FastAPI, you can wrap it into async.\n\n(The below code structure is from [Stackoverflow](https://stackoverflow.com/questions/43241221/how-can-i-wrap-a-synchronous-function-in-an-async-coroutine).)\n\n```python\nimport asyncio\n\nfrom yahoo_search import search\n\n\nasync def asearch(loop, query):\n    # None uses the default executor (ThreadPoolExecutor)\n    await loop.run_in_executor(\n        None, \n        search, \n        query\n    )\n```\n\n## Models \u0026 Functions Definitions\n\nBelow are the models \u0026 functions type definitions.\n\n\u003cdetails\u003e\n    \u003csummary\u003eSee All Models (15)\u003c/summary\u003e\n\n```python\nclass AlsoTryItem(BaseModel):\n    link: str\n    text: str\n\nclass PageResult(BaseModel):\n    title: str\n    link: str\n    text: Optional[str] = None\n\nclass CardResultSource(BaseModel):\n    link: str\n    text: str\n\nclass CardResult(BaseModel):\n    image: Optional[str] = None\n    heading: Optional[str] = None\n    text: Optional[str] = None\n    source: Optional[CardResultSource] = None\n\nclass RelatedSearch(BaseModel):\n    link: str\n    text: str\n\nclass SearchResult(BaseModel):\n    also_try: List[AlsoTryItem]\n    pages: List[PageResult]\n    card: Optional[CardResult] = None\n    related_searches: List[RelatedSearch]\n\nclass News(BaseModel):\n    title: str\n    thumbnail: Optional[str] = None\n    source: Optional[str] = None\n    last_updated: Optional[str] = None\n    text: Optional[str] = None\n\nclass NewsSearchResult(BaseModel):\n    news: List[News]\n\nclass Video(BaseModel):\n    age: Optional[str] = None\n    cite: Optional[str] = None\n    thumbnail: Optional[str] = None\n    video_preview: Optional[str] = None\n    title: str\n    link: str\n\nclass VideoSearchResult(BaseModel):\n    videos: List[Video]\n\nclass HighLowTemperature(BaseModel):\n    highest: int\n    lowest: int\n\nclass WeatherForecastInner(BaseModel):\n    text: str\n    icon: str\n\nclass Precipitation(BaseModel):\n    icon: str\n    percentage: str\n\nclass WeatherForecast(BaseModel):\n    fahrenheit: HighLowTemperature\n    celsius: HighLowTemperature\n    weather: WeatherForecastInner\n    precipitation: Precipitation\n\nclass WeatherInformation(BaseModel):\n    location: str\n    country: str\n    time: str\n    celsius: int\n    fahrenheit: int\n    weather: str\n    weather_icon: str\n    forecast: Dict[\n        Literal[\n            \"Monday\", \n            \"Tuesday\", \n            \"Wednesday\", \n            \"Thursday\", \n            \"Friday\", \n            \"Saturday\", \n            \"Sunday\"\n        ],\n        WeatherForecast\n    ]\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n    \u003csummary\u003eSee All Functions (4)\u003c/summary\u003e\n\n```python\ndef search(query: str) -\u003e SearchResult: ...\ndef search_news(query: str) -\u003e NewsSearchResult: ...\ndef weather() -\u003e WeatherInformation: ...\ndef autocomplete(query: str) -\u003e List[str]: ...\n```\n\n\u003c/details\u003e\n\n---\n\nNo, this time I'm not bored. I just want to practice webscraping.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faweirddev%2Fyahoo-search","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faweirddev%2Fyahoo-search","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faweirddev%2Fyahoo-search/lists"}