Python google searcher in 10 lines

Поделиться
HTML-код
  • Опубликовано: 10 фев 2025

Комментарии • 283

  • @manojsingh6294
    @manojsingh6294 5 лет назад +40

    One more request Hitesh, please provide part 2 of this and show how we can grab contents of each link opened !

    • @SalmanKhan-pu6sc
      @SalmanKhan-pu6sc 4 года назад +2

      You can do web scrapping for that

    • @MohitKumar-tw7qd
      @MohitKumar-tw7qd 4 года назад

      Check default browser settings.

    • @zen35x19
      @zen35x19 3 года назад +1

      @Brian Marlon thanks for this did this to my cousin to scare her lol I'm to lonely to have a girlfriend 😢😂

    • @explisid9510
      @explisid9510 3 года назад

      ruclips.net/video/zXif_9RVadI/видео.html&ab_channel=DataSchool

  • @ankushbanik1764
    @ankushbanik1764 6 лет назад +42

    Yes.. sir we all are looking for this type of videos... ..
    Sir can u start a series for intermediate python learners ... Sir thanks so much. Love u a lot

  • @axelb15
    @axelb15 3 года назад +1

    “Fun malicious script”, ah yes

  • @moveonvillain1080
    @moveonvillain1080 3 года назад +1

    Your 'fun' script ended up being just the thing I was looking for, thanks.
    I can go to sleep now because it's 3 am and I probably should sleep

  • @nikhil_somani
    @nikhil_somani 4 года назад

    Yes if i dont work as it is you might need to make change to
    soup.select('.r a') to
    soup.select('#div#main > div > div > div > a')

  • @sanjibpramanik9268
    @sanjibpramanik9268 6 лет назад

    Sir,
    I want to ask you a question that is not related to this video, and request you for answer. My question is 'how some website sell windows10 genuine product key for just ₹750-₹1000, while microsoft sell it ₹8K - ₹15K. How can it possible sir? Is this cheap keys are really genuine? How many years this cheap keys can activate the windows?' This is my first comment on youtube, and I hope I'll get the true answer from you. You are the amazing knowledgeable person I've ever seen, that's why I'm asking you. And really sorry if there has been any mistake to write my comment correctly, coz I've very little knowledge about english.
    And once again I must tell you that you are really amazing.

  • @airsicklowlander9593
    @airsicklowlander9593 3 года назад +3

    Can someone please explain the soup.select('.r a') line ? Why not just soup.select('a')

  • @WanderWithMuskan
    @WanderWithMuskan 5 лет назад +1

    Sir it didn't open any browser in python 3.8 and also doesnt give any error it compiles and ends

  • @vipulgarg5336
    @vipulgarg5336 5 лет назад +6

    Hello Hitesh!
    Thanks for Such a nice Tutorial really informative.
    I wrote the same code as explained in video but while running the scipts using cmdprompt I am not seeing any webbrowser window opened for me. I tried multiple times. It is not throwing any error while running the script.
    Please let me know how to resolve this.

    • @vipulgarg5336
      @vipulgarg5336 5 лет назад +8

      I got it correct
      the syntax of regex expression need to modify to -->linkElements = soup.select(r'a')
      instead of linkElements = soup.select('.r a') it worked for me.

    • @alejandrorivera9567
      @alejandrorivera9567 5 лет назад +1

      @@vipulgarg5336 thanks bro

    • @mohammedzuhair5335
      @mohammedzuhair5335 4 года назад +1

      @@vipulgarg5336 Thanks alot broo you are a savior !!

    • @zeeshansadiq6150
      @zeeshansadiq6150 3 года назад

      @@vipulgarg5336 thankful to u

    • @luisiv.459
      @luisiv.459 2 года назад

      thanks!

  • @vaibhavrai4140
    @vaibhavrai4140 2 года назад

    thanks a lot for all my movie tickets in advance

  • @darkpigeye
    @darkpigeye 2 года назад

    This video is proof anything is better than python

  • @venkatakrishnannaidukuna3155
    @venkatakrishnannaidukuna3155 4 года назад +1

    Your code doesn't give any error but it is not opening the browser. How can I solve this?

  •  4 года назад +19

    hiya there, i'm working with windows so whenever i call from my system the code nothing happen what i could, there is not any error, but neither a single browser open.

    • @namanxai
      @namanxai 4 года назад

      Same Here

    • @darshilshah560
      @darshilshah560 4 года назад

      same here

    • @kavinbharathi
      @kavinbharathi 4 года назад

      same thing and I'm sitting in front my laptop for 15 minutes like a sleep paralysis demon who hasn't slept for days

    • @gean02203
      @gean02203 4 года назад +1

      i was doing in pycharm, and i took off the '.r' from the soup.select

    • @gean02203
      @gean02203 4 года назад +4

      soup = bs4.BeautifulSoup(res.text, 'html.parser')
      linkElements = soup.select('a')
      linkToOpen = min(1, len(linkElements))
      for i in range(linkToOpen):
      webbrowser.open('ruclips.net/user/results?search_query='+quest)

  • @namansinha792
    @namansinha792 6 лет назад +2

    Sir
    Is it possible to scrap audio/video files from Google search results.
    Ex: If i search for a song in Google then, we can scrap all audio files from that results. We don't have to go inside any website.
    Sir if possible then please make a video in this
    🙂

  • @arasoftware3948
    @arasoftware3948 3 года назад

    hello mine is finishing the debugging without any results or errors what is the problem

  • @rajdave9862
    @rajdave9862 5 лет назад +4

    OmNs hey hey hey please tell me from where you learn so much python library in proper way (book, website, college, RUclips) please 🙏 🙏 tell me

  • @niranjanadevisekar3505
    @niranjanadevisekar3505 6 лет назад +4

    Very super 👏! Thanks... Feeling very happy while running this code. You live long well so we know more😎... Thanks from hearts !

  • @hibiki35z4
    @hibiki35z4 3 года назад

    where is the part where the search word is used in the code?

  • @thoufiqmohammed8627
    @thoufiqmohammed8627 4 года назад +5

    Hi, Thanks for the video. I see this was done in Oct 2018 hency may have worked that time. But now, it doesn't work. Because requests.get() doesn't return complete HTML code. So basically your line no 6 returns empty list.
    Do you have a solution to overcome this?

    • @iamivjot
      @iamivjot 4 года назад

      have you found any solution?

    • @sualehalam4259
      @sualehalam4259 4 года назад

      @@iamivjot you have to use selenium library to do open browser instead of the requests library. Hope it helps.

    • @CardinalCuber
      @CardinalCuber 3 года назад

      @@sualehalam4259 how exactly should I change the code- should it just be importing selenium and that’s it? Or is there more to it

  • @kunalpangare7371
    @kunalpangare7371 4 года назад +1

    result is not open in browsser

  • @anubhavsrivastava2759
    @anubhavsrivastava2759 3 года назад

    To run in windows .. we should type .... python searcher.py 'youtube' or python3 searcher.py 'youtube' ?? (1st one isn't working)

  • @CrunchyBall5
    @CrunchyBall5 3 года назад

    what changes would i need to make if i was using a different search engine?

  • @李昊-v3y
    @李昊-v3y 4 года назад

    Why don't open a web browser?

  • @sahilnarang2986
    @sahilnarang2986 3 года назад

    Hi, Thank you for the video. What did you do while searching for the keyword 'HiteshChoudhary'. I'm running in Jupyter notebook did not understand it.

  • @manojsingh6294
    @manojsingh6294 5 лет назад +2

    Hi Hitesh, its just lovely, I want to learn more in Web Automation using bs4 or Selenium, please let me know if you have designed a course on this!

  • @kick-tech4691
    @kick-tech4691 6 лет назад +2

    Everytime after watching your video the energy and your dedication makes me to work even harder .
    My android app will hit the play store very soon sir.
    Thank u Hitesh sir

  • @rudranshmishra5587
    @rudranshmishra5587 5 лет назад +1

    Please Help Me.. what if I want to search anything in compiler

  • @pranjalpathak4498
    @pranjalpathak4498 5 лет назад +3

    Does not work.
    soup.select('.r a') returns an empty list!

    • @sriharshas3889
      @sriharshas3889 5 лет назад +1

      Yes

    • @haiderghufran7323
      @haiderghufran7323 5 лет назад

      same

    • @haiderghufran7323
      @haiderghufran7323 5 лет назад

      i have removed .r from that line... now it look like soup.select('a') instead of this soup.select('.r a').... and its working

    • @haiderghufran7323
      @haiderghufran7323 5 лет назад

      actually the correct syntax to use raw strings in this case could be this soup.select(r'a') where r is outside the single quotes not inside!

    • @pranjalpathak4498
      @pranjalpathak4498 5 лет назад

      @@haiderghufran7323 Returns invalid syntax!!

  • @zachohan3534
    @zachohan3534 3 года назад

    what if we just want to fetch number of search results for a term in a sheet rather than opening links?

  • @noname-deadend777
    @noname-deadend777 3 года назад +1

    how to play spotify songs in python

  • @maneswarjha1879
    @maneswarjha1879 6 лет назад +2

    I started watching your videos when I started learning programming 8 months ago,and this the first technical video of yours that I could understand.😚😁😁

  • @crytpoex_ploiter4295
    @crytpoex_ploiter4295 3 года назад

    Just wanted to know how to make it work in background plz help

  • @DominicNweze
    @DominicNweze 2 года назад

    Miine did not search the code just ran. But nothing searched

  • @SpotTheError1
    @SpotTheError1 6 лет назад +2

    U can do many thing but ur doing teaching jobs thank you

  • @CardinalCuber
    @CardinalCuber 3 года назад

    please make an updated version of this!

  • @popeye8083
    @popeye8083 4 года назад +1

    I tried this code but not working

  • @Faceless_News_Channel
    @Faceless_News_Channel 4 года назад

    My program is successfully running but not giving appropriate output.

  • @rahulmandal1380
    @rahulmandal1380 6 лет назад

    Really Python is getting popular !,than before.
    ☺️☺️ ☺️☺️☺️ ☺️🙂🙂 🙂🙂🙂

    • @HiteshCodeLab
      @HiteshCodeLab  6 лет назад +1

      python - Always popular, even from my Engineering time

  • @SiWos100
    @SiWos100 2 года назад

    Is there a Way to get the amount of search results?

  • @prasanthk8048
    @prasanthk8048 3 года назад

    it is not working in jupyther, can you say proces in jupyter

  • @RameshKumar-pk3si
    @RameshKumar-pk3si 6 лет назад

    Dear sir its fun more fun is one of search says Hitesh sir joined 24 Oct 2011 also its true amazing sir .Thank you so much.

  • @DEVIL_SKULLER
    @DEVIL_SKULLER 3 года назад +1

    Bro how can I give input to this

  • @andrewlancaster8810
    @andrewlancaster8810 4 года назад +2

    My script is not working on the linkElements = soup.select('.r a') as it returns 'null'. Thoughts?

  • @kavitayadav608
    @kavitayadav608 2 года назад

    Hi Hitesh,
    Your video was really helpful. I started python recently and it was really helpful.
    I have a request it it possible to right those code on Jupyter notebook as I was using Jupyter. I tried this same libraries but they are not working. So if you can help me that would be really helpful.
    Thank you

  • @slaysite4533
    @slaysite4533 3 года назад

    i tried but its not working....cd Desktop/test/
    I dont understand the meaning of "ls" i guess thats why it didnt work...help pls

  • @kamranahmed413
    @kamranahmed413 6 лет назад +1

    Sir, plz share the link of your desktop wallpaper. I really like it.

  • @ScoutKnows
    @ScoutKnows 5 лет назад +4

    the script runs but it doesn't show the results in my browser
    any idea what's going on with my issue ?

    • @alejandrorivera9567
      @alejandrorivera9567 5 лет назад

      i have the same problem, anyone have an idea?

    • @alejandrorivera9567
      @alejandrorivera9567 5 лет назад

      searching into comments i foum these, i hope you can use it, for me is worked
      "vipul garg"
      Hace 7 meses (editado)
      I got it correct
      the syntax of regex expression need to modify to -->linkElements = soup.select(r'a')
      instead of linkElements = soup.select('.r a') it worked for me.

  • @daytrivial7374
    @daytrivial7374 5 лет назад

    i ran this on windows using visual studio. it didnt work for me. it said erorn 2=file directory cannot be found. i have changed the path severally but still fails. any way out?

  • @rifkagupta5886
    @rifkagupta5886 5 лет назад +2

    sir where to write parameter while running this code using pycharm

    • @infofinance5159
      @infofinance5159 5 лет назад

      HI, I had same issue,
      I changed code that way:
      search_terms = search_terms.replace(' ', '%20')
      url = 'google.com/search?q='+''.join(search_terms)
      print(url)
      res = requests.get(url)
      But i am having issues getting href links. I am unsure if the css_selector changes from one country to another.

  • @akshitagarg5914
    @akshitagarg5914 6 лет назад

    You are back.... was missing your videos....when flutter and Adobe will continue?

  • @jsbean8415
    @jsbean8415 4 года назад

    How about if i am searching for multiple names or object in google?

  • @omkanade5
    @omkanade5 3 года назад

    Hi Hitesh,
    I have multiline text from tkinter UI which is stored in var 'a'. how do i use that var 'a' for searching in google instead of this string i.e. your name? Please revert back with that 1/2 line of code.

  • @terminatorfishstudios
    @terminatorfishstudios 3 года назад

    **fun**, and malicious do not belong in the same sentence lol.

  • @weilunlee3082
    @weilunlee3082 4 года назад

    Hi Hitesh, i followed your instruction but doesn't seem to work.. is it the functions has changed? please advise thank!

  • @paulsnehasish5830
    @paulsnehasish5830 4 года назад

    linkElement = soup.select('.r a') ----- this line is not opening any pages in browser
    when i remove (.r) it opens perfectly but i get 2 extra blank google search pages first then the desired result appears....any solutions?

    • @sinnerman-i4r
      @sinnerman-i4r 4 года назад +1

      Hello,
      I tried the same and I got what you said some extra empty tabs
      So I dig into some concepts and modified the present code
      The present basics of code working are same we make requests open url using webbrowser library but I saw a pattern that in this link for example www.google.com/ after this part is there is /search?q= part with arguments infront of it as said in video it opens according to arguments but if it is not then it just opens home page of google that is www.google.com
      www.google.com/search?q=PewDiePie&ie=UTF-8&source=lnms&tbm=shop&sa=X&ved=0ahUKEwja_vjouM3sAhXPXCsKHTKIDkYQ_AUIDCgF
      So I wrote a code such that it checks if that q tage for arguments is present or not and then proceed to consider it as a link to be opened
      Here is the code ( Just a try from me anyone could do it better and modify this, and look out for indentations if you are copying this code and trying it in compiler)
      import requests, sys, webbrowser, bs4
      def search(text) :
      linkElements = []
      linkToOpen = []
      i = 0

      res = requests.get('google.com/search?q='+''.join(text))
      res.raise_for_status()
      soup = bs4.BeautifulSoup(res.text, "html.parser")
      linkElements = soup.find_all('a')
      while(len(linkToOpen)

    • @aminoobgamer5467
      @aminoobgamer5467 3 года назад +1

      @@sinnerman-i4r Thank you bro!

    • @sinnerman-i4r
      @sinnerman-i4r 3 года назад +1

      @@aminoobgamer5467 😊👍

  • @harshitsachdeva7201
    @harshitsachdeva7201 6 лет назад

    Sir....i am working as a .net developer in an IT giant ....but want to js ....please tell me the way ...i joined as a fresher few days back but cant change my domain

  • @subratabhanu2627
    @subratabhanu2627 4 года назад

    i wrote the same program but why i am getting error in line 3???

  • @EL3ino
    @EL3ino 3 года назад

    What apps do i need to do this?

  • @arshjain1532
    @arshjain1532 6 лет назад

    Really liked this video!
    Where can I find the whole series of python videos?

  • @ashishmishra7214
    @ashishmishra7214 6 лет назад

    I'm getting HTTPError for the line (raise_for_status()) and it also say's service for requested url is unavailable ?? ;(

  • @NSGameplay24
    @NSGameplay24 4 года назад

    How can i do exactly this thing using voice command....?? Thanks in advance 🙂

  • @prashantrana1089
    @prashantrana1089 4 года назад

    why not use direct api ? this is wrong approch

  • @ayushsoni96
    @ayushsoni96 5 лет назад

    #getting top10 links and printing them and opening all those lionks in new tab
    import time
    from googlesearch import search
    import webbrowser
    web=input("eneter to search")
    url=[]
    for i in search(web,stop=10):
    print(i)
    webbrowser.open_new_tab(i)
    time.sleep(1)
    url.append(i)
    print(url)

  • @sanjiv0704
    @sanjiv0704 6 лет назад

    bro code is compiled but no t opening in browser nd not even in pycharm too can u help

  • @alexandercharles3064
    @alexandercharles3064 2 года назад

    Some one plz suggest me how i can scrape all the text(or data ) from the first result

  • @emmirr04
    @emmirr04 3 года назад

    I cannot test a file idk where to go

  • @trutharrow5311
    @trutharrow5311 3 года назад

    When you talk fast your accent screams i.n.d.i.a.n

  • @WujekOzzy
    @WujekOzzy 3 года назад

    Anyone know why it doesn't work? LinkElements is always empty for me

  • @aryangurung30
    @aryangurung30 4 года назад +1

    File "search.py", line 4, in
    res.raise_for_status()
    File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/requests/models.py", line 941, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
    THIS WAS MY ERROR

  • @__sagar_shah__591
    @__sagar_shah__591 5 лет назад

    this code has an error
    IndentationError: expected an indented block

  • @friedrichii...582
    @friedrichii...582 4 года назад

    3:00 my favourite xD
    u got my like

  • @akashgeorge5433
    @akashgeorge5433 3 года назад

    linkelements is returning an empty list >>can any1 help

  • @atulgupta5109
    @atulgupta5109 4 года назад

    Hi Hitesh, what is sys.argv[1:]

  • @masklask4444
    @masklask4444 5 лет назад

    mine opens and closes immediately how can i fix it.

  • @NinjaCoder472
    @NinjaCoder472 6 лет назад +4

    Sir as always, you are the best.....

  • @sauravsingh-wb4ow
    @sauravsingh-wb4ow 6 лет назад

    I have to say that learning programming from you is awsm and make things easier thanks a lot for your help keep doing

    • @HiteshCodeLab
      @HiteshCodeLab  6 лет назад

      making things easier is my first goal. :)

  • @hack3bh3_ctf_player
    @hack3bh3_ctf_player 4 года назад +1

    Not working!

  • @ehizuelenabhulimen8433
    @ehizuelenabhulimen8433 4 года назад

    I used your code but it doesnt work

  • @narashi2744
    @narashi2744 3 года назад

    Every line got 1 minute to explain.

  • @findingnemo4637
    @findingnemo4637 6 лет назад

    This code is not running for me sir, I m using pycharm

  • @yashrajanshukla7790
    @yashrajanshukla7790 6 лет назад +1

    Let's make the hot and sour soup

  • @akshaydesai4805
    @akshaydesai4805 6 лет назад +2

    sir what about Firebase ML-kit Face detection tutorial???
    still waiting for that tutorial😎

  • @renjithroy8422
    @renjithroy8422 6 лет назад

    Why did you go for Leancodeonline.in and not learncodeonline.com ?

    • @HiteshCodeLab
      @HiteshCodeLab  6 лет назад +2

      Some youtubers will say, it's because I love my country.
      But I will not say that.

    • @dheeraj5087
      @dheeraj5087 6 лет назад

      Hitesh bro using .com instead of .in is advantageous

  • @joshvanathan1000
    @joshvanathan1000 4 года назад

    Hello Hitesh,
    I'm using Ubuntu 18.04
    As per your video, I did the same thing on my PC. Unfortunately, the webbrowser wasn't opening and showing up with the results.
    I'm using Google Chrome and Mozilla.

    • @electrowizard2658
      @electrowizard2658 2 года назад

      so change the refernce to mozilla or bing and trying!

  • @AChadi-ug9pg
    @AChadi-ug9pg 6 лет назад +1

    can u do a video on how to convert py to exe plzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz

  • @saadahmedkhan990
    @saadahmedkhan990 3 года назад

    Ok for some reason it doesn't run so can you help either way good tutorial

  • @tussharverma8704
    @tussharverma8704 4 года назад +1

    loved your video,
    This can be done in one line , but different links cant be open
    as
    import webbrowser
    query = "hi"
    for i in range(number_of_times):
    webbrowser.open("google.com/search?q={}".format(query))

    • @xfire3778
      @xfire3778 4 года назад

      This code doesn’t even look like it works

    • @tussharverma8704
      @tussharverma8704 4 года назад

      Ok give a try, if found some error, provide it, will help me a lot, in correcting myself, thanku

    • @yungoracle3490
      @yungoracle3490 4 года назад +2

      bro it does work but i want to make with href

    • @yungoracle3490
      @yungoracle3490 4 года назад

      can anyone help me pls

    • @tussharverma8704
      @tussharverma8704 4 года назад

      @@yungoracle3490 use beautifulsoup and scrape the link!!! You can find tutorial of this, this video is also very helpful

  • @Kumarsivam003
    @Kumarsivam003 6 лет назад

    Sir, I am getting 503 server error, service unavailable for ulr: https....
    I also added user agent still

  • @akshitagarg5914
    @akshitagarg5914 6 лет назад

    Pls give link of your Python series

  • @stefaniramalho
    @stefaniramalho 5 лет назад

    Did you try run the same code now? I think that doens't work

    • @ssticman
      @ssticman 4 года назад

      It doesn’t work any way to make it work?

  • @thulasiramn723
    @thulasiramn723 6 лет назад

    Really a nice video to watch. I'll love to see some more cool Python videos of yours.
    So any suggestions bro .

    • @HiteshCodeLab
      @HiteshCodeLab  6 лет назад +2

      There is a python mini series of web scraping, check that out.

  • @praveenkumar-tz6fu
    @praveenkumar-tz6fu 6 лет назад

    Hi Hitesh. you really made good videos. I have a question. I have installed python 3.7 in my windows. when I try to install libraries like the way you did, I didn't get any libraries. it says invalid syntax. I'm completely new to this Python.

  • @stealthseeker18
    @stealthseeker18 6 лет назад

    Thanks for this video bro. I have a problem using Python since as we know Python performance is not good as NodeJS performance. Can you please create a video about how to optimize Python code for better performance? 😃😃😃

  • @say_hon3y
    @say_hon3y 5 лет назад

    How can i open these links using voice in my chatbot Maya

  • @shyamsaktawat7334
    @shyamsaktawat7334 6 лет назад +2

    Make some viedo over PHP programming tooo sir.and we all love it efforts sir😍

  • @slowedbgm
    @slowedbgm 4 года назад

    Yes right.

  • @rahullranjan
    @rahullranjan 6 лет назад +5

    I liked the video first then start watching because you always give us awesome quality content sir.

  • @m3hdim3hdi
    @m3hdim3hdi 4 года назад

    how can you do this with javascript?

  • @aarjurajarya4855
    @aarjurajarya4855 4 года назад

    sir this program is not running in my Mac I install all required
    stufs

    • @xfire3778
      @xfire3778 4 года назад

      Then it is working

  • @technosoid2821
    @technosoid2821 6 лет назад

    hey can you say something about cs16 programming language