{"id":13640065,"url":"https://github.com/goose3/goose3","last_synced_at":"2025-04-20T02:32:36.864Z","repository":{"id":39842838,"uuid":"76196733","full_name":"goose3/goose3","owner":"goose3","description":"A Python 3 compatible version of goose http://goose3.readthedocs.io/en/latest/index.html","archived":false,"fork":false,"pushed_at":"2024-08-20T20:57:37.000Z","size":5236,"stargazers_count":810,"open_issues_count":16,"forks_count":99,"subscribers_count":18,"default_branch":"master","last_synced_at":"2024-10-02T09:18:54.237Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"HTML","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/goose3.png","metadata":{"files":{"readme":"README.rst","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.txt","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}},"created_at":"2016-12-11T20:04:21.000Z","updated_at":"2024-09-27T00:59:41.000Z","dependencies_parsed_at":"2024-01-15T23:27:25.368Z","dependency_job_id":"290697b8-7e83-4458-b6da-39e17b62a620","html_url":"https://github.com/goose3/goose3","commit_stats":{"total_commits":589,"total_committers":61,"mean_commits":9.655737704918034,"dds":0.6740237691001698,"last_synced_commit":"6265da542e391846a7ef87697cc3434e8e50b19f"},"previous_names":[],"tags_count":26,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/goose3%2Fgoose3","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/goose3%2Fgoose3/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/goose3%2Fgoose3/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/goose3%2Fgoose3/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/goose3","download_url":"https://codeload.github.com/goose3/goose3/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223816369,"owners_count":17207843,"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-08-02T01:01:07.435Z","updated_at":"2025-04-20T02:32:36.852Z","avatar_url":"https://github.com/goose3.png","language":"HTML","funding_links":[],"categories":["资源列表","HTML"],"sub_categories":["网页内容提取"],"readme":"Goose3 - Article Extractor\n===============================================\n\n.. image:: https://img.shields.io/badge/license-Apache_2.0-blue.svg\n    :target: https://opensource.org/licenses/Apache-2.0/\n    :alt: License\n.. image:: https://github.com/goose3/goose3/workflows/Python%20package/badge.svg?branch=master\n    :target: https://github.com/goose3/goose3/actions?query=workflow%3A%22Python+package%22\n    :alt: Build Status\n.. image:: https://img.shields.io/github/release/goose3/goose3.svg\n    :target: https://github.com/goose3/goose3/releases\n    :alt: GitHub release\n.. image:: https://codecov.io/gh/goose3/goose3/branch/master/graph/badge.svg?token=PoWLaCLbW1\n    :target: https://codecov.io/gh/goose3/goose3\n    :alt: Test Coverage\n.. image:: https://badge.fury.io/py/goose3.svg\n    :target: https://badge.fury.io/py/goose3\n    :alt: PyPi Release\n.. image:: http://pepy.tech/badge/goose3\n    :target: https://pepy.tech/project/goose3\n    :alt: Downloads\n\nIntro\n--------------------------------------------------------------------------------\n\nGoose was originally an article extractor written in Java that has most\nrecently (Aug2011) been converted to a `scala project \u003chttps://github.com/GravityLabs/goose\u003e`_.\n\nThis is a complete rewrite in Python. The aim of the software is to\ntake any news article or article-type web page and not only extract what\nis the main body of the article but also all meta data and most probable\nimage candidate.\n\nGoose will try to extract the following information:\n\n-  Main text of an article\n-  Main image of article\n-  Any YouTube/Vimeo movies embedded in article\n-  Meta Description\n-  Meta tags\n\nThe Python version was originally rewritten by:\n\n-  Xavier Grangier\n\nLicensing\n--------------------------------------------------------------------------------\n\nIf you find Goose useful or have issues please drop me a line. I'd love\nto hear how you're using it or what features should be improved.\n\nGoose is licensed by Gravity.com under the Apache 2.0 license; see the\nLICENSE file for more details.\n\nOn-line Documentation\n--------------------------------------------------------------------------------\nOn-line documentation is available on\n`Read the Docs \u003chttps://goose3.readthedocs.io\u003e`_ which contains more in-depth\ndocumentation.\n\nSetup\n--------------------------------------------------------------------------------\n\nTo install using pip, with all supported languages, which will install additional dependencies:\n\n.. code-block::\n\n    pip install goose3[all]\n\nTo install the minimal version:\n\n.. code-block::\n\n    pip install goose3\n\nTo install just the dependencies for a single language:\n\n.. code-block::\n\n    pip install goose3[chinese]\n    pip install goose3[arabic]\n\nTo install from source:\n\n.. code-block::\n\n    mkvirtualenv --no-site-packages goose3\n    git clone https://github.com/goose3/goose3.git\n    cd goose3\n    pip install -r ./requirements/python\n    python setup.py install\n\nTake it for a spin\n--------------------------------------------------------------------------------\n\n.. code-block:: python\n\n    \u003e\u003e\u003e from goose3 import Goose\n    \u003e\u003e\u003e url = 'http://edition.cnn.com/2012/02/22/world/europe/uk-occupy-london/index.html?hpt=ieu_c2'\n    \u003e\u003e\u003e g = Goose()\n    \u003e\u003e\u003e article = g.extract(url=url)\n    \u003e\u003e\u003e article.title\n    u'Occupy London loses eviction fight'\n    \u003e\u003e\u003e article.meta_description\n    \"Occupy London protesters who have been camped outside the landmark St. Paul's Cathedral for the past four months lost their court bid to avoid eviction Wednesday in a decision made by London's Court of Appeal.\"\n    \u003e\u003e\u003e article.cleaned_text[:150]\n    (CNN) - Occupy London protesters who have been camped outside the landmark St. Paul's Cathedral for the past four months lost their court bid to avoi\n    \u003e\u003e\u003e article.top_image.src\n    http://i2.cdn.turner.com/cnn/dam/assets/111017024308-occupy-london-st-paul-s-cathedral-story-top.jpg\n\nConfiguration\n--------------------------------------------------------------------------------\n\nThere are two ways to pass configuration to goose. The first one is to\npass goose a Configuration() object. The second one is to pass a\nconfiguration dict.\n\nFor instance, if you want to change the userAgent used by Goose just\npass:\n\n.. code-block:: python\n\n    \u003e\u003e\u003e g = Goose({'browser_user_agent': 'Mozilla'})\n\nSwitching parsers: Goose can now be used with lxml html parser or lxml\nsoup parser. By default the html parser is used. If you want to use the\nsoup parser pass it in the configuration dict :\n\n.. code-block:: python\n\n    \u003e\u003e\u003e g = Goose({'browser_user_agent': 'Mozilla', 'parser_class':'soup'})\n\nOne can also set Goose to be more lenient on network exceptions. To turn off\nthrowing all network exceptions, set the strict configuration setting to false:\n\n.. code-block:: python\n\n    \u003e\u003e\u003e g = Goose({'strict': False})\n\n\nTo turn on image fetching, one can simply enable it using the enable_image_fetching\nconfiguration property:\n\n.. code-block:: python\n\n    \u003e\u003e\u003e g = Goose({'enable_image_fetching': True})\n\n\nGoose is now language aware\n--------------------------------------------------------------------------------\n\nFor example, scraping a Spanish content page with correct meta language\ntags:\n\n.. code-block:: python\n\n    \u003e\u003e\u003e from goose3 import Goose\n    \u003e\u003e\u003e url = 'http://sociedad.elpais.com/sociedad/2012/10/27/actualidad/1351332873_157836.html'\n    \u003e\u003e\u003e g = Goose()\n    \u003e\u003e\u003e article = g.extract(url=url)\n    \u003e\u003e\u003e article.title\n    u'Las listas de espera se agravan'\n    \u003e\u003e\u003e article.cleaned_text[:150]\n    u'Los recortes pasan factura a los pacientes. De diciembre de 2010 a junio de 2012 las listas de espera para operarse aumentaron un 125%. Hay m\\xe1s ciudad'\n\nSome pages don't have correct meta language tags, you can force it using\nconfiguration :\n\n.. code-block:: python\n\n    \u003e\u003e\u003e from goose3 import Goose\n    \u003e\u003e\u003e url = 'http://www.elmundo.es/elmundo/2012/10/28/espana/1351388909.html'\n    \u003e\u003e\u003e g = Goose({'use_meta_language': False, 'target_language':'es'})\n    \u003e\u003e\u003e article = g.extract(url=url)\n    \u003e\u003e\u003e article.cleaned_text[:150]\n    u'Importante golpe a la banda terrorista ETA en Francia. La Guardia Civil ha detenido en un hotel de Macon, a 70 kil\\xf3metros de Lyon, a Izaskun Lesaka y '\n\nPassing {'use\\_meta\\_language': False, 'target\\_language':'es'} will\nforcibly select Spanish.\n\n\nVideo extraction\n--------------------------------------------------------------------------------\n\n.. code-block:: python\n\n    \u003e\u003e\u003e import goose3\n    \u003e\u003e\u003e url = 'http://www.liberation.fr/politiques/2013/08/12/journee-de-jeux-pour-ayrault-dans-les-jardins-de-matignon_924350'\n    \u003e\u003e\u003e g = goose3.Goose({'target_language':'fr'})\n    \u003e\u003e\u003e article = g.extract(url=url)\n    \u003e\u003e\u003e article.movies\n    [\u003cgoose.videos.videos.Video object at 0x25f60d0\u003e]\n    \u003e\u003e\u003e article.movies[0].src\n    'http://sa.kewego.com/embed/vp/?language_code=fr\u0026playerKey=1764a824c13c\u0026configKey=dcc707ec373f\u0026suffix=\u0026sig=9bc77afb496s\u0026autostart=false'\n    \u003e\u003e\u003e article.movies[0].embed_code\n    '\u003ciframe src=\"http://sa.kewego.com/embed/vp/?language_code=fr\u0026amp;playerKey=1764a824c13c\u0026amp;configKey=dcc707ec373f\u0026amp;suffix=\u0026amp;sig=9bc77afb496s\u0026amp;autostart=false\" frameborder=\"0\" scrolling=\"no\" width=\"476\" height=\"357\"/\u003e'\n    \u003e\u003e\u003e article.movies[0].embed_type\n    'iframe'\n    \u003e\u003e\u003e article.movies[0].width\n    '476'\n    \u003e\u003e\u003e article.movies[0].height\n    '357'\n\n\nGoose in Chinese\n--------------------------------------------------------------------------------\n\nSome users want to use Goose for Chinese content. Chinese word\nsegmentation is way more difficult to deal with than occidental\nlanguages. Chinese needs a dedicated StopWord analyser that need to be\npassed to the config object.\n\n.. code-block:: python\n\n    \u003e\u003e\u003e from goose3 import Goose\n    \u003e\u003e\u003e from goose3.text import StopWordsChinese\n    \u003e\u003e\u003e url  = 'http://www.bbc.co.uk/zhongwen/simp/chinese_news/2012/12/121210_hongkong_politics.shtml'\n    \u003e\u003e\u003e g = Goose({'stopwords_class': StopWordsChinese})\n    \u003e\u003e\u003e article = g.extract(url=url)\n    \u003e\u003e\u003e print article.cleaned_text[:150]\n    香港行政长官梁振英在各方压力下就其大宅的违章建筑（僭建）问题到立法会接受质询，并向香港民众道歉。\n\n    梁振英在星期二（12月10日）的答问大会开始之际在其演说中道歉，但强调他在违章建筑问题上没有隐瞒的意图和动机。\n\n    一些亲北京阵营议员欢迎梁振英道歉，且认为应能获得香港民众接受，但这些议员也质问梁振英有\n\nGoose in Arabic\n--------------------------------------------------------------------------------\n\nIn order to use Goose in Arabic you have to use the StopWordsArabic\nclass.\n\n.. code-block:: python\n\n    \u003e\u003e\u003e from goose3 import Goose\n    \u003e\u003e\u003e from goose3.text import StopWordsArabic\n    \u003e\u003e\u003e url = 'http://arabic.cnn.com/2013/middle_east/8/3/syria.clashes/index.html'\n    \u003e\u003e\u003e g = Goose({'stopwords_class': StopWordsArabic})\n    \u003e\u003e\u003e article = g.extract(url=url)\n    \u003e\u003e\u003e print article.cleaned_text[:150]\n    دمشق، سوريا (CNN) - أكدت جهات سورية معارضة أن فصائل مسلحة معارضة لنظام الرئيس بشار الأسد وعلى صلة بـ\"الجيش الحر\" تمكنت من السيطرة على مستودعات للأسل\n\n\nGoose in Korean\n--------------------------------------------------------------------------------\n\nIn order to use Goose in Korean you have to use the StopWordsKorean\nclass.\n\n.. code-block:: python\n\n    \u003e\u003e\u003e from goose3 import Goose\n    \u003e\u003e\u003e from goose3.text import StopWordsKorean\n    \u003e\u003e\u003e url='http://news.donga.com/3/all/20131023/58406128/1'\n    \u003e\u003e\u003e g = Goose({'stopwords_class':StopWordsKorean})\n    \u003e\u003e\u003e article = g.extract(url=url)\n    \u003e\u003e\u003e print article.cleaned_text[:150]\n    경기도 용인에 자리 잡은 민간 시험인증 전문기업 ㈜디지털이엠씨(www.digitalemc.com).\n    14년째 세계 각국의 통신·안전·전파 규격 시험과 인증 한 우물만 파고 있는 이 회사 박채규 대표가 만나기로 한 주인공이다.\n    그는 전기전자·무선통신·자동차 전장품 분야에\n\nTODO\n--------------------------------------------------------------------------------\n\n-  Video html5 tag extraction\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgoose3%2Fgoose3","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgoose3%2Fgoose3","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgoose3%2Fgoose3/lists"}