Comments (8)
Hey @fortyfourforty, I can't replicate this issue with the given URL, also they aren't using json-ld. Can you provide more details as Trafilatura version?
from trafilatura.
Hi @felipehertzer, I just tested with a clean install the issue is gone. Guess it has to do with my own code. Thanks for your time testing!
from trafilatura.
Thanks @fortyfourforty & @felipehertzer for your feedback.
from trafilatura.
Another example of the same problem.
I've tested with a clean pip install, uses trafilatura's built-in fetch and can reproduce the same error. @felipehertzer @adbar
Error url : https://www.safetyinsurance.com/
Error: /usr/local/lib/python3.10/dist-packages/trafilatura/json_metadata.py in extract_json(schema, metadata)
63 if metadata.sitename is None or (len(metadata.sitename) < len(candidate) and content_type != "webpage"):
64 metadata.sitename = candidate
---> 65 if metadata.sitename is not None and metadata.sitename.startswith('http') and not candidate.startswith('http'):
66 metadata.sitename = candidate
67
AttributeError: 'list' object has no attribute 'startswith'
Function:
downloaded = fetch_url(url)
res = trafilatura.extract(downloaded, output_format="xml", include_comments=False)
output_format="json"
also produces the same error.
The workaround is by commenting out the corresponding metadata.sitename
check. But I'm also looking for an official fix.
from trafilatura.
The webpage is currently offline, I tried with an archived version (https://web.archive.org/web/20230607164633/https://www.safetyinsurance.com/
) and I cannot reproduce the problem. Are you using the last Trafilatura version?
from trafilatura.
Yes, last Trafilatura version. @adbar
Pip install in colab with a new notebook dedicated for testing.
I tested again with a notebook, you can have a look.
The site is not offline as I just tested and you can also see the source in the notebook.
https://colab.research.google.com/drive/1Bm5rJpt40_veEAGREOwIw-EcMelXHiCr?usp=sharing
from trafilatura.
Thanks @fortyfourforty, I can reproduce the bug using the HTML in the notebook.
@felipehertzer Do you have an idea?
from trafilatura.
Hey @adbar,
The problem is that this website is using alternateName as list instead of text. I added a extra to avoid that bug.
https://schema.org/Organization
from trafilatura.
Related Issues (20)
- include_links breaks the extraction for https://news.ycombinator.com HOT 2
- Consider switching from lxml's clean_html for enhanced security (and possibly performance) HOT 1
- Error when multiproessing HOT 1
- Multiple spaces within a text element are not supported HOT 5
- Inconsistent behavior on macOS HOT 3
- Unable to extract text from a given site, TypeError: unhashable type: 'set' HOT 5
- crawl only sub-pages from an arbitrary URL? HOT 3
- Parts are getting missed out after using extract funtion HOT 1
- List items are being missed HOT 6
- Entire/majority content of these 2 sites being missed out HOT 4
- trafilatura fails extracting HOT 7
- colors and error in running gui HOT 2
- xml namespace support in sitemaps HOT 1
- XML Parsing breaks on valid HTML HOT 4
- Text extraction performance fix. HOT 1
- Python 3.12 support for MacOS HOT 2
- Cannot fetch url with more than 2 redirections HOT 1
- i could not extract tables from trafilatura library HOT 1
- Few issues with tests. HOT 1
- Here is an interesting example... any tips? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from trafilatura.