Coder Social home page Coder Social logo

Comments (5)

adbar avatar adbar commented on June 1, 2024 1

Hi @ReySadeghi I have trouble downloading the page as well with Python, I'm afraid this problem exceeds the scope of the library.

This solution works on the command-line:
wget -O - "https://www.isna.ir/news/1400070704627/%D8%AA%D8%B5%D8%A7%D9%88%DB%8C%D8%B1-%D8%AE%D8%A7%D8%B1%D9%82-%D8%A7%D9%84%D8%B9%D8%A7%D8%AF%D9%87-%D8%A7%D8%B2-%D8%B2%D9%85%DB%8C%D9%86-%DA%A9%D9%87-%D8%AA%D9%88%D8%B3%D8%B7-%D9%85%D8%A7%D9%87%D9%88%D8%A7%D8%B1%D9%87-%D9%84%D9%86%D8%AF%D8%B3%D8%AA-%D8%AB%D8%A8%D8%AA-%D8%B4%D8%AF%D9%87-%D8%A7%D9%86%D8%AF" | trafilatura

from trafilatura.

adbar avatar adbar commented on June 1, 2024

Hi @ReySadeghi, I cannot reproduce the bug with standard extraction, are you using the latest version of the software and are you using particular options?

from trafilatura.

ReySadeghi avatar ReySadeghi commented on June 1, 2024

yes, I used version of 1.3.0
my code is this:

import trafilatura
downloaded = trafilatura.fetch_url(url)
json_file=trafilatura.bare_extraction(downloaded, include_links=True)
#json_file= trafilatura.extract(downloaded, output_format='json')

date=json_file['date']

from trafilatura.

adbar avatar adbar commented on June 1, 2024

Hi @ReySadeghi, thanks for the additional info. I still cannot reproduce the error, I think there are two explanations here:

  1. The line where you run the extraction with output_format='json' is commented out... So there is no date attribute in the result (which is a string).
  2. The download didn't work and no error has been caught, so there is no result in the end, which triggers the error. For more on downloads see this docs section

Does that solve your problem?

from trafilatura.

ReySadeghi avatar ReySadeghi commented on June 1, 2024

Hi again,
thanks for your response.
also I tried both methods : "bare_extraction" and "extract",
but I couldn't download and got the Error.

I tried download section that you mentioned, but nothing happen.
I think maybe my URL is under restriction by trafilatura.
I also tried with vpn but it doesn't solve.
could you please try to download this URL:

url="https://www.isna.ir/news/1400070704627/%D8%AA%D8%B5%D8%A7%D9%88%DB%8C%D8%B1-%D8%AE%D8%A7%D8%B1%D9%82-%D8%A7%D9%84%D8%B9%D8%A7%D8%AF%D9%87-%D8%A7%D8%B2-%D8%B2%D9%85%DB%8C%D9%86-%DA%A9%D9%87-%D8%AA%D9%88%D8%B3%D8%B7-%D9%85%D8%A7%D9%87%D9%88%D8%A7%D8%B1%D9%87-%D9%84%D9%86%D8%AF%D8%B3%D8%AA-%D8%AB%D8%A8%D8%AA-%D8%B4%D8%AF%D9%87-%D8%A7%D9%86%D8%AF"

from trafilatura.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.