Git Product home page Git Product logo

Comments (2)

alexmercerind avatar alexmercerind commented on September 27, 2024

Hi @dmdoniz !

This module is simply based on web-scraping, it makes similar to following network request for getting results:

request = f"https://www.youtube.com/results?search_query={keyword}&page={offset}&sp={<search-filter>}"
  • The "max_results" parameter is to limit the number of results you are receiving, not exceed the results that YouTube offers in that page..

    • I added it in because, assume a user wants only one video in the result, then the script will break the loop just after one video is sorted from the response and will give better performance to the user.
  • We can make the number of results same as the user provided in "max_results", but for that we have to make multiple network requests with different "offset" values, which can affect performance. I haven't planned this, at the moment.

  • Results are not always limited at 20, you can even get somewhere around 35 results too for some queries, it is over YouTube.

At the moment, for getting different videos in result, you can set offset > 1, to get videos on next pages of YouTube.

  • "offset" is more like "page" but now I cannot change the name of this parameter as people are using this library now.

Thankyou!
Feel to free to re-open issue or provide feedback, in case you feel it.

from youtube-search-python.

alexmercerind avatar alexmercerind commented on September 27, 2024

I very strongly recommend updating to v1.2.5 with:

pip3 install youtube-search-python==1.2.5

It has a big fix for a "mistake", I made in v1.2.4.

from youtube-search-python.

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.