GithubHelp home page GithubHelp logo

focused_crawl returns nothing about trafilatura HOT 6 CLOSED

bezir avatar bezir commented on July 26, 2024
focused_crawl returns nothing

from trafilatura.

Comments (6)

bezir avatar bezir commented on July 26, 2024 1

Here is my code with an example input.

Code:

def crawl_homepage(homepage_url, max_iteration, output_file):
    to_visit, known_links = focused_crawler(homepage_url, max_seen_urls=1)

    i = 0
    while i < max_iteration:
        to_visit, known_links = focused_crawler(homepage_url, max_seen_urls=10, max_known_urls=300000, todo=to_visit, known_links=known_links)
        print("LEN", len(known_links))
        save_links_to_file(known_links, output_file + ".json")  # Save links to file after every iteration
        i += 1
    print(f"Finished crawling. Total iterations: {i}")

homepage_url = "https://tr.motorsport.com"

p.s: the page has nothing to do with my task, I share a random url that fails in the extract process.

from trafilatura.

adbar avatar adbar commented on July 26, 2024

The task is complex and the focused crawler integrated in Trafilatura does not solve all problems. I cannot answer this question in general. Do you have a precise example for me to reproduce?

from trafilatura.

adbar avatar adbar commented on July 26, 2024

If you set the logging level to debug you'll see that the download fails (403 error), so there are no links to extract.

from trafilatura.

bezir avatar bezir commented on July 26, 2024

How to fix it? I want to be able to get the news links in the website.

from trafilatura.

adbar avatar adbar commented on July 26, 2024

You have to use a more complex download utility to make sure you get the full content, then you can use Trafilatura on the HTML.

from trafilatura.

bezir avatar bezir commented on July 26, 2024

Thank you Adrien!

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.