Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed incorrect variable passed to extract_metadata #678

Merged
merged 1 commit into from
Aug 16, 2024

Conversation

jpigla
Copy link
Contributor

@jpigla jpigla commented Aug 15, 2024

An incorrect variable (url) was previously passed to the filecontent parameter of the extract_metadata function, which expects HTML code as a string.

This problem was solved by passing the result of the fetch_url function (stored in the variable downloaded) to extract_metadata::

from trafilatura import fetch_url, extract_metadata

downloaded = fetch_url('https://github.blog/2019-03-29-leader-spotlight-erin-spiceland/')
extract_metadata(downloaded)

An incorrect variable (url) was previously passed to the `filecontent` parameter of the **extract_metadata** function, which expects HTML code as a string.

This problem was solved by passing the result of the **fetch_url** function (stored in the variable `downloaded`) to **extract_metadata**::

```python
from trafilatura import fetch_url, extract_metadata

downloaded = fetch_url('https://github.blog/2019-03-29-leader-spotlight-erin-spiceland/')
extract_metadata(downloaded)
```
Copy link

codecov bot commented Aug 15, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.39%. Comparing base (dcb769f) to head (4458112).
Report is 1 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #678   +/-   ##
=======================================
  Coverage   98.39%   98.39%           
=======================================
  Files          21       21           
  Lines        3486     3486           
=======================================
  Hits         3430     3430           
  Misses         56       56           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@adbar adbar merged commit 0fb6e43 into adbar:master Aug 16, 2024
15 checks passed
@adbar
Copy link
Owner

adbar commented Aug 16, 2024

Good catch, thanks!

@jpigla jpigla deleted the patch-1 branch August 16, 2024 12:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants