Build A Python App That Tracks Amazon Prices!

Поділитися
Вставка
  • Опубліковано 13 гру 2024

КОМЕНТАРІ • 2 тис.

  • @heeheemanwhut
    @heeheemanwhut 5 років тому +2589

    Begins with, "If you're poor, you're gonna love this episode".
    Noice.

  • @MarioOrtiz008
    @MarioOrtiz008 5 років тому +439

    Instead of price[1:5] you could have used price[:-3]. That way, the actual length of the string doesn't matter. It will just remove the last 3 characters (decimals + € symbol)

    • @RickyC0626
      @RickyC0626 5 років тому +56

      Or you can do price[1:] to get all the characters after the currency symbol and cast it to float. The resulting value can also be used to calculate total price for a list of products

    • @Chemistry-uh2gj
      @Chemistry-uh2gj 5 років тому +4

      @@RickyC0626 Good idea!

    • @borispsalman
      @borispsalman 5 років тому +5

      or use regular expressions but as for me i still dont understand them fully :D

    • @CFabio6
      @CFabio6 5 років тому +16

      This! if the price goes under 1000 it's gonna crash with price[1:5]

    • @sidheshwartiwari9834
      @sidheshwartiwari9834 5 років тому

      Noice

  • @jakeruth4603
    @jakeruth4603 5 років тому +217

    "It will never stop, just like my mental state." Once again, I am left with more questions than answers. Thank you Ed -jake

    • @ramiiii
      @ramiiii 4 роки тому +2

      wonderful.

    • @Sagar_Sorout
      @Sagar_Sorout 4 роки тому +1

      It's not working in my system

    • @Sagar_Sorout
      @Sagar_Sorout 4 роки тому

      It's not working

    • @buybestphone
      @buybestphone 4 роки тому

      @@ramiiii amazing too.

    • @alialshah8466
      @alialshah8466 3 роки тому

      Will the program continue running if I close the pycharm

  • @poly2081
    @poly2081 4 роки тому +61

    5:18 someone at amazon has too much time

  • @gimmeplaylistnow
    @gimmeplaylistnow 5 років тому +148

    This dude: "Okay, if you're poor, you're going to love this episode!
    Me: "I'm listening..."

  • @JosepPi
    @JosepPi 5 років тому +618

    sees while(true)
    *Yells in C++*

    • @dmitrov6464
      @dmitrov6464 5 років тому +114

      *Never stops yelling*

    • @davidson2329
      @davidson2329 5 років тому +6

      I started learning c++ and I am now kinda used to it and when I look at this... why didn't he make a universal function....

    • @zaraf
      @zaraf 5 років тому +2

      I was so triggerd

    • @walfranpinto80
      @walfranpinto80 5 років тому +4

      im new to coding, mind explaining?

    • @psd.3144
      @psd.3144 5 років тому +3

      @@walfranpinto80 it's just an infinite loop that will always run when the program gets to it. True is always true so it will never not run.
      You usually want some kind of limit on how much a loop can run, especially in something like the c language family. Python kinda saves you from bad memory management because it does a lot on it's own, but it is a convention not to do that if others are working with or going to use your code.
      Since this is more of a concept style of video tutorial, it isn't really an issue though.

  • @shahfahad.muslim
    @shahfahad.muslim 5 років тому +4

    I'm not still in Python, but subscribed to make sure that this awesome man stays when I need him.
    thanks for cool stuff bro.

  • @TrimorphMC
    @TrimorphMC 5 років тому +192

    15:05 Duplicate code; you forgot that you already wrote that!

    • @nourios6991
      @nourios6991 5 років тому +40

      Marked as duplicate.

    • @nonsudunk
      @nonsudunk 5 років тому +5

      @@nourios6991 I understood that reference!

    • @saptarshisengupta5073
      @saptarshisengupta5073 5 років тому +5

      What do you expect. They know shit about programming.

    • @clank2269
      @clank2269 4 роки тому

      @@saptarshisengupta5073 what

  • @98Etienne98
    @98Etienne98 5 років тому +16

    Thank you! I'm trying to learn python and little projects like this are really what i was looking for!

    • @aipython
      @aipython 4 роки тому +1

      Good to know that you are interested in Python project, I have also created a playlist for Python project. Do check it: ua-cam.com/play/PLBeeFF3JmXWCQh987TsdowLK5U8XwbSzw.html

  • @lolmeeky
    @lolmeeky 2 роки тому +4

    thank you so much for this tutorial! some things dont currently work (since this video is a few years old now and Amazon has changed your ability to scrape from them, it seems), but I still learned the basics about web scraping from this! I changed up my program to also send price differences from other websites too. Even the parts about 2-factor verification were useful and now its something extra I know! Thanks again!

  • @onrebruit
    @onrebruit 5 років тому +7

    Your videos are natural and unique. You make me feel we are having one on one tutorials.

  • @andreaf6143
    @andreaf6143 5 років тому +34

    Good sample but anyway you have to use in headers the directive 'Cache-Control': 'no-cache' else you will see the same page always and you can't get the new price.
    headers = {'Cache-Control': 'no-cache', "Pragma": "no-cache"}

    • @alexanderandrukov9903
      @alexanderandrukov9903 5 років тому

      Are u sure? Shouldn't it check first the date of the last real update of a page before returning cached page? Hint: there is a special header for that in HTTP protocol.

    • @devmarkk
      @devmarkk 5 років тому

      i'm interested, following the conv

  • @user-te1le7ck6b
    @user-te1le7ck6b 5 років тому +4

    Brilliant as a computer science teacher I will be utilising this for a project
    Keep up the great work

  • @DontBeMadBro
    @DontBeMadBro 5 років тому +4

    just to point out, remember that price[0:5] will not be effective for smaller prices, in such a case, i would consider split this string by delimiter, which is dot and then save the first part of the outcome. This way script won't be dependent by different number of digits, nice tutorial!

    • @HaynesX
      @HaynesX 5 років тому +1

      Why not just .replace() the comma and currency symbol with nothing and convert to float to get the exact price? Or is that very inefficient?

  • @MaBuSt
    @MaBuSt 4 роки тому +2

    this was a great episode, thanks!
    i'm new here but appreciate the simplicity - almost would prefer you also show you googling the things you googled to FIND the packages you dl'd and imported. SOunds a little goofy, but really new people often ask how you knew what packages to use, and it's so helpful to show experienced people googling it.

  • @richarddoci
    @richarddoci 5 років тому +196

    loving the python tutorials! It'd be awesome if you did a python app with some interfaces or something. 😄

  • @idhamarsyd
    @idhamarsyd 5 років тому +36

    Awesome!! Maybe you can share your setup about VSCode, sir! Your theme, fileicon theme, font or even useful extension. Thanksss

    • @balhazer
      @balhazer 5 років тому +1

      x34, deliver dude, pretty please!

    • @nikolayvarlamov4065
      @nikolayvarlamov4065 5 років тому +2

      Matherial theme
      He has a video about his VS CODE config:
      ua-cam.com/video/ULssP63AhPw/v-deo.html

  • @hamidnikbakht1295
    @hamidnikbakht1295 4 роки тому +20

    This guy is a legend! Just look at the way he sits behind his computer and in front of camera!

  • @prajwalpkulkarni
    @prajwalpkulkarni 4 роки тому +7

    Thank you Dev Ed! This works!
    I feel so powerful right now xD
    Looking for more tuts from your side!
    Cheers from India!

  • @GabrielsEpicLifeofGoals
    @GabrielsEpicLifeofGoals 5 років тому +41

    I am only concerned at the fact that Amazon used "MEOW" somewhere in their code...

    • @gatikgarg4007
      @gatikgarg4007 4 роки тому +1

      That was a comment

    • @hidalg
      @hidalg 4 роки тому

      jajajaja me too

    • @CODEBYTE
      @CODEBYTE 4 роки тому +1

      someone had too much time to include that . Lmao .

  • @sagargada73
    @sagargada73 5 років тому +46

    " In python we are cooler we do this the other way" 😂😂😂

    • @brewman467
      @brewman467 4 роки тому

      Afaik there is no Import in JavaScript. However it exists in NodeJS.

    • @alialshah8466
      @alialshah8466 3 роки тому

      Would the program still run if I close pycharm

    • @damnatioodiosis5537
      @damnatioodiosis5537 3 роки тому

      @@alialshah8466 i had the same doubt

  • @raqha4575
    @raqha4575 5 років тому +41

    "And dont send 1000 request to mess with their server"... pff you know us. We never wanna do things like this...

    • @FlyingUnosaur
      @FlyingUnosaur 3 роки тому

      Amazon isn't very pro scraping. They'll block you real quick.

    • @16bitart
      @16bitart 3 роки тому +1

      ​@@FlyingUnosaur True, that's way I had to develop scraper that use 50+ threads to collect thousands of products every day.

    • @FlyingUnosaur
      @FlyingUnosaur 3 роки тому

      @@16bitart did you use proxies?

    • @16bitart
      @16bitart 3 роки тому +1

      @@FlyingUnosaur Yes, this is only way. But I used free proxies with rotation.

    • @FlyingUnosaur
      @FlyingUnosaur 3 роки тому

      @@16bitart ok thank you

  • @kentlai
    @kentlai 5 років тому +4

    I'm a Python beginner, your video is awesome. Please make more Python tutorial

  • @mohamedaminealouini4292
    @mohamedaminealouini4292 5 років тому +1

    There are 2 enhancements for this video
    First one: You could pass the URL as an argument, so the function could be more generic
    Second: If you were on Linux (I don't know about Windows), you could use CRON Jobs to execute the code
    Nice job and good episode

  • @gulle7578
    @gulle7578 5 років тому +37

    “HAVE YOU HEARD OF HONNEY!”
    “THIS VIDEO IS SPONSORED BY HONEY”
    “THIS VIDEO WOULDN’T BE POSSIBLE WITH OUT HONEY”

  • @aryankatebain
    @aryankatebain 5 років тому +13

    Man please more videos... You are a fantastic teacher 👨‍🏫

  • @JarosawTabor
    @JarosawTabor 5 років тому +52

    Ok. After this video I'm definitly sure, that I want to learn Python. Damn. Easy win.

    • @DarrenSemotiuk
      @DarrenSemotiuk 5 років тому +4

      Seems python = crush JavaScript first, then forget { } exist instead just indent #ez

  • @jackbird5839
    @jackbird5839 3 роки тому +4

    I am python beginner and this simple application will give some good practice
    great solution and tips bro!! thank you for your video.
    as a non-tech user, I am using amazon review scraper e-scraper maybe it helps to somebody too.

  • @patriotsecular6631
    @patriotsecular6631 5 років тому +1

    hey ed, prashant here.. i appreciate the way you are always smiling and something in the presentation takes the stress out of the coding part :) I am a subscriber to the channel now ::)

  • @ugurkoc3030
    @ugurkoc3030 5 років тому

    For who has problems about converting string to float, you should replace coma with point
    price = soup2.find(id= "priceblock_ourprice").get_text()
    converted_price = float(price[1:6].replace(",","."))
    print(converted_price)
    Output = 1.998

  • @cheskoxd
    @cheskoxd 4 роки тому +3

    9:15 he googled python web scrapping amazon XDXDXD i love this man xd

  • @kimzauto5045
    @kimzauto5045 5 років тому +23

    hmmm Yahoo?... internet modem flash backs🔥🔥🔥🔥🔥

  • @thomasdejong232
    @thomasdejong232 5 років тому +5

    In my VS code i don't see an explanation of the functions as you have. At 5:01 typing "title = soup.find"
    How can I get this?

    • @yassineelb8735
      @yassineelb8735 5 років тому +4

      guess python extension for intellisense

    • @DamienLaRocque
      @DamienLaRocque 5 років тому

      You get that by installing the Python extension : marketplace.visualstudio.com/items?itemName=ms-python.python

  • @Sawell123
    @Sawell123 4 роки тому +2

    I found a solution for the "none" return/error instead of the title (or price - depends what you want to scrape):
    instead of writing
    soup = BeautifulSoup(page.content, 'html.parser')
    I used
    soup = BeautifulSoup(page.content, 'lxml')
    and it works for me. I got to the point that i can send emails :) thanks for this tutorial!

    • @nmana9759
      @nmana9759 4 роки тому +1

      Thank you so much!!

  • @susannam3923
    @susannam3923 2 роки тому +2

    did anyone else have the problem where the soup data was really short and had things like "if you want access go to some Subscription API" and "we want to make sure you're not a bot and you should enable cookies"

  • @zaidangaming1288
    @zaidangaming1288 5 років тому +12

    Subscribed!
    Didn’t know about you, saw one video and now you’re my fav! Haha.

    • @aipython
      @aipython 4 роки тому

      Hello, Do check out the cool Python project video from this playlist: ua-cam.com/play/PLBeeFF3JmXWCQh987TsdowLK5U8XwbSzw.html

  • @rishabhraj2446
    @rishabhraj2446 5 років тому +23

    I tried but when I try to find something it returns none 😅

    • @leveltube10
      @leveltube10 5 років тому +1

      Me also! What goes wrong?

    • @edinsonrequena1089
      @edinsonrequena1089 5 років тому +1

      also to me and I tried everything

    • @jugginator4390
      @jugginator4390 5 років тому +1

      If you're printing a function, it'll likely return none there. None is returned when, well, nothing is returned haha. He's printing off something the has a value inside the function which is why it worked, but if you just print a function, it'll say none unless you return something. Kinda like, say I made a function def math(): x = 5 x 5. if I print(math()), it'll say none. If i add a return, like def math(): x = 5 x 5 return x, now the print will display 25.

    • @dunkboyys2361
      @dunkboyys2361 5 років тому +2

      Try typing requests.get(URL), instead of requests.get(URL, headers=headers). Line 9 on video.

    • @dansvanz92
      @dansvanz92 5 років тому

      @@dunkboyys2361 Thank you

  • @adityashinde3864
    @adityashinde3864 5 років тому +33

    Please make more JavaScript videos.

    • @developedbyed
      @developedbyed  5 років тому +18

      Will make js videos too don't wory, but it can get a bit monotone for me to only do that 24/7 😀

  • @Marco110981
    @Marco110981 3 роки тому

    You can have this python script executed in crontab (if using Linux), so the script will be run systematically some, say, 1 or 2 times a day, and the price will be checked in the background without even noticing it. I included the logging of the price to a text file, and the plot of its temporal evolution so to have a nice overview of the trend, and for each item I have included in a a list (with its belonging threshold).
    Keep it up, Dev Ed - nice going!

  • @jasonabba3934
    @jasonabba3934 5 років тому +1

    DISCOVERED YOUR CHANNEL LAST NIGHT! TOO GOOD.

  • @samanbalal824
    @samanbalal824 5 років тому +7

    At 16:30 , why converted_price > 1.700 in two if statements?

    • @The_TermiGator
      @The_TermiGator 5 років тому +9

      he forgot he did it already and didn't notice

    • @Pcpiee
      @Pcpiee 5 років тому +5

      just to be extra sure

    • @thebiziii
      @thebiziii 5 років тому +1

      By the way, these two conditions are not the same..

    • @youtu6er860
      @youtu6er860 5 років тому +1

      @@thebiziii What do you mean that they are not the same. He changed the second one, that's true but only because he wanted to demonstrate the function if the condition is true.
      They are both the same

    • @thebiziii
      @thebiziii 5 років тому

      > is not the same as

  • @3AgL3DeeJay
    @3AgL3DeeJay 5 років тому +4

    13:19 why not just add the "URL" variable after that string? that way you won't have a problem if you modify only the link above and forget about the second one

    • @jasperdiscovers
      @jasperdiscovers 5 років тому +1

      came here looking for this comment :)

    • @3AgL3DeeJay
      @3AgL3DeeJay 5 років тому

      @@jasperdiscovers Nice :))

    • @PauJuanes
      @PauJuanes 5 років тому +1

      And literally ONE second later he uses f' ' string formatting to explain how to include a variable inside a string LOL. He also called the send_mail() function twice with two identical if statements. I guess he forgot he already wrote that piece of code two minutes earlier. Anyway, he did a really good job. Not complaining at all.

  • @omonibash4556
    @omonibash4556 5 років тому +4

    I am facing this problem when I try to print title on 6:34
    AttributeError: 'NoneType' object has no attribute 'get_text'

    • @Toopa88
      @Toopa88 5 років тому

      Because you have to check the name of the "id". You can't simply copy his id because it returns None if it doesn't find anything. You are basically doing None.get_text()

    • @rayanaay5905
      @rayanaay5905 5 років тому

      Same. Any advice?

    • @timetosleep8055
      @timetosleep8055 5 років тому +2

      He is using the .de (germany) domain and not .com (international), if you use the german or uk domain it will work.

    • @ugurkoc3030
      @ugurkoc3030 5 років тому

      if soup2.find(id="productTitle").__len__() > 0:
      title = soup2.find(id= "productTitle").get_text()
      print(title.strip())
      else:
      title = "No result"
      print(title)

  • @pythonwonderwoman7164
    @pythonwonderwoman7164 4 роки тому

    I have added also 'else' with small print to inform me that price has not changed without while True loop. and I used Windows task scheduler to check the price once per day. thanks a lot, love your positive attitude!

  • @Lukas-ds4qp
    @Lukas-ds4qp 4 роки тому

    I would like to program a dynamic logogenerator with export and preview function in Python. Specifically, an existing image is to be supplemented by five entries - after which the supplemented logo can be exported as ".zip", where .png, .pdf, and .png of the logo can be found.
    In addition, there should be two preview areas, which should dynmaically adapt to what has been entered in the above mentioned entries. There will be two preview areas to the right of the five entrys

  • @obaidashurbaji9223
    @obaidashurbaji9223 4 роки тому +5

    at min 5:45 i tried it and it gave me this (AttributeError: 'NoneType' object has no attribute 'get_text')
    what's the problem?

    • @godihateyoutube
      @godihateyoutube 4 роки тому +2

      In the documentation for Beautiful Soup, it says that the find() method will return None if no element with the given id is found. Meaning, whatever you listed as the id was not found in the html content you pulled.

    • @noahsigel3529
      @noahsigel3529 4 роки тому

      @@godihateyoutube you cant use bs4 anymore

    • @keremozbakir8089
      @keremozbakir8089 4 роки тому +2

      The solution is actually quite easy, html parser cant parse Amazon html very well just use html5lib instead or lxml my friend

    • @juliangeiler2515
      @juliangeiler2515 4 роки тому

      it works but only every 4th or 5th time =( what can i do now?

    • @keremozbakir8089
      @keremozbakir8089 4 роки тому

      @@juliangeiler2515 what's the error you get? I will try to help you if i can.

  • @nonamenoname2618
    @nonamenoname2618 5 років тому +5

    But as soon as you close the program (the code in Virtual Studio) you also close the loop, correct? So you need to have your python-program continuously running?

    • @TheDirtyClean
      @TheDirtyClean 5 років тому

      Noname Noname yea same thoughts. Has to run on a server to be not useless i guess :D

    • @johnmcmenamin7692
      @johnmcmenamin7692 4 роки тому +1

      Or use cron/a scheduler to run it occasionally

  • @bruhmoment_79
    @bruhmoment_79 5 років тому +6

    5:16 How come when I print(title) it says None

    • @mudman4048
      @mudman4048 5 років тому

      R u sure your variable is named correctly?

    • @crashbunks
      @crashbunks 5 років тому +6

      soup = bs(page.content, 'html.parser')
      soup2 = bs(soup.prettify(), "html.parser")
      use soup2 instead

    • @jamesfriend4865
      @jamesfriend4865 5 років тому

      im having same problem

    • @pratikrana2265
      @pratikrana2265 5 років тому

      ​@@HansPeter-gx9ew I'm using Ubuntu OS. I'm facing same issue.. I tried your suggestion but it doesn't work for me.
      Error :
      The code that caused this warning is on line 11 of the file scraper.py. To get rid of this warning, pass the additional argument 'features="html.parser"' to the BeautifulSoup constructor.
      soup1 = BeautifulSoup(page.content, "html")
      scraper.py:12: UserWarning: No parser was explicitly specified, so I'm using the best available HTML parser for this system ("html.parser"). This usually isn't a problem, but if you run this code on another system, or in a different virtual environment, it may use a different parser and behave differently.
      The code that caused this warning is on line 12 of the file scraper.py. To get rid of this warning, pass the additional argument 'features="html.parser"' to the BeautifulSoup constructor.
      soup2 = BeautifulSoup(soup1.prettify(), "html")
      output :
      None

    • @jacobmoran3102
      @jacobmoran3102 5 років тому

      @@HansPeter-gx9ew Thank you! However, I got warning to specify a parser, so I used "lxml" instead of "html." Works as expected now.

  • @reaperagario2961
    @reaperagario2961 4 роки тому +2

    Just to clarify!
    1) On 13:45 he uses two '
    ' (newline) because the SMTP protocol wants you to format the email this way:
    Subject: YOUR_SUBJECT


    //empty_line
    ACTUAL_MESSAGE

    . //a line only with a dot
    2) On 11:31 he connects to the mail server through the port 587 because that's the default port SMTP uses.
    SMTP also uses TLS to send the data through packets and they're encrypted.
    Enjoy!!

  • @AakashBanodhe
    @AakashBanodhe 5 років тому

    Of all the tutorials I have seen, this explained far better. Thanks.

  • @danielrubenacker8206
    @danielrubenacker8206 5 років тому +7

    "it's not stopping! It will never stop, just like my mental state" lol, lmao. ;)

  • @sreerammeka9238
    @sreerammeka9238 5 років тому +4

    I have a question, when I try to print using "print(page.status_code)", the result is 503 which means that the service is unavailable, what does it mean?
    Does it mean it is not available to handle our requests??

  • @ericlin8331
    @ericlin8331 5 років тому +11

    I need this guy in my life
    Subscribered.

  • @notrash4256
    @notrash4256 4 роки тому +1

    If you want to make it more flexible try:
    pricewithouteuro = price.replace('€','')
    pricewithouteuro = pricewithouteuro.replace(',','.')
    convertedprice = float(pricewithouteuro)
    print(convertedprice)

  • @krishnaprasad3350
    @krishnaprasad3350 5 років тому

    SMTPLIB stands for Simple Mail Transfer Protocol LIBrary. It is used to send,read,etc emails on a basic level.

  • @MrPherez
    @MrPherez 5 років тому +4

    I like your project, keep sharing mind blowing projects champ

  • @fun-ih5sc
    @fun-ih5sc 5 років тому +5

    Awesome man , loved this. Just now executed my code.
    Thanks a lot for making this video
    keep making video like this

  • @povilaskirna4108
    @povilaskirna4108 5 років тому +10

    You should explain how to make it run silently and on the start of the pc

    • @adventune375
      @adventune375 5 років тому +3

      (On windows 10. Haven't tested on other versions of windows or any other os) Make the .py file .pyw file. Then type win+r and type 'shell:startup'. It will open a folder where you move your .pyw file or shortcut to it. Next time you boot it will run script silently on the background. You're welcome
      Edit: Also change the code so that if the price hasn't dropped it goes back to checkPrice() and quits when it has dropped and send the mail

    • @ZeroPlayer119
      @ZeroPlayer119 5 років тому

      @@adventune375 can you run this on a web server ?

    • @adventune375
      @adventune375 5 років тому

      @@ZeroPlayer119 I don't know. Haven't tested it. You maybe need to modify it a bit but it could be possible

    • @Jmonsky
      @Jmonsky 5 років тому

      @@ZeroPlayer119 Yes, as long as the web server has python installed.

    • @dachs91
      @dachs91 5 років тому

      You could also just move the script to your windows startup repository (:\Users\Username\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup). I also made a schedule system for the script. I will post the link to my github if you want it.

  • @proyxm
    @proyxm 5 років тому

    This is so cool! I'm using it to track System of a down tour data, it will create a link-file to the page on my desktop as soon as there are new tourdates scheduled. I don't even have to check emails. Thank you so much! Want to give multiple thumbs up!

  • @angelowolff7127
    @angelowolff7127 5 років тому

    u can also just fetch all the html data, compare new and old data and if they are different, then a change was made on the page. then just pull whatever data was changed into a table. u can also use text logic like integer,integer.integer is most likely assumed as the price format, then u can redact all string results and u most likely will end up with a collection of changed prices. I think this way allows the only changing input to be the site address, but can be used on multiple sites that use the price format integer,integer.integer.

  • @scorpion32
    @scorpion32 4 роки тому +3

    omg this is so useful, I'm gonna apply this to other things

  • @abhinavdeep6628
    @abhinavdeep6628 5 років тому +3

    Hey dude, this is 1st time I'm watching your video but loved it really I mean I'm in love with it. Yeah and subscribed it with notification bell so don't worry. See you soon.😍😍

  • @rishijoshi5808
    @rishijoshi5808 5 років тому +9

    Yo, great content bruh. Could you also share with us as to how do you research about those libraries you used in the video? Thanks very much!

    • @justincv
      @justincv 5 років тому +1

      Hey Rishi! You can have a look at www.tutorialspoint.com/python/python_modules.htm Specifically have a look at built-in modules
      :D Good luck

  • @sridharraju3249
    @sridharraju3249 4 роки тому

    Really cool Dev Ed! Easy to scrap things better.. loved it!!!

  • @pistolpeet5325
    @pistolpeet5325 5 років тому

    smtplib is a library in Python that uses the SMTP(simple mail transport protocol) layer to send emails from a client

  • @kamilmuza4417
    @kamilmuza4417 5 років тому +6

    if statement with parentheses?
    python zen: We don't do that here my friend.

    • @demeter1793
      @demeter1793 5 років тому

      The while loop as well

    • @kamilmuza4417
      @kamilmuza4417 5 років тому

      Дмитрий Авдеев didn’t watch that long, as soon as i saw that, i just bailed.

  • @3AgL3DeeJay
    @3AgL3DeeJay 5 років тому +5

    14:45 how can you not see that you have the same if condition and send_mail() function just 3 lines above....???

  • @NackDSP
    @NackDSP 4 роки тому +4

    Awesome. I set this up on my Raspberry Pi and had it ring a bell when my price target was reached. Saved me $100 today.

  • @theuselessprogrammer3034
    @theuselessprogrammer3034 4 роки тому

    This is actually more simple that I originally thought, very interesting video mate

  • @andyn6053
    @andyn6053 5 років тому

    Great stuff! Straight forward and made simple! Thanks mate!

  • @aoof6742
    @aoof6742 5 років тому +3

    13:27 USE THE VARIABLE OH MY GOD.

  • @shafmairaj6493
    @shafmairaj6493 5 років тому +13

    i have written the same code like yours and i got "None" after executing the file
    help please!

    • @sibbonsshrestha3438
      @sibbonsshrestha3438 5 років тому +15

      soup = BeautifulSoup(page.content, 'html.parser')
      soup1 = BeautifulSoup(soup.prettify(), "html.parser")
      title = soup1.find(id="productTitle")
      print(title)
      recommended by a guy earlier

    • @ennissg
      @ennissg 5 років тому +2

      @@sibbonsshrestha3438 Thank You

    • @varunbhonsle8109
      @varunbhonsle8109 4 роки тому

      that part is written in JS so its technically not there.use selenium

    • @filippocerchi1083
      @filippocerchi1083 4 роки тому

      @@sibbonsshrestha3438 I LOVE YOU.

  • @TheTrophieStars
    @TheTrophieStars 4 роки тому +12

    Seems as if amazon no longer easily allows scraping like this.

    • @mokafi7
      @mokafi7 4 роки тому +3

      oh is that why it wasnt working for me? i wasted 3 hours trying to get this working...

    • @pai64
      @pai64 4 роки тому +1

      @@mokafi7 F

    • @FRElHEIT
      @FRElHEIT 4 роки тому

      I expected this and first searched the comments before wasting hours of my life. F

    • @reedheadable
      @reedheadable 4 роки тому +2

      @@FRElHEIT I added a Referer to my header and it seem to bypass the web scraper block ex. Referer : "www.google.com"

    • @pytharian2660
      @pytharian2660 4 роки тому

      Works for mw

  • @ahmadaminfarooq8495
    @ahmadaminfarooq8495 5 років тому

    Started from here and now Scrapy expert, Amazing video.

  • @ad910am
    @ad910am 5 років тому +2

    if soup.find returns None, what u have to add is:
    soup1 = BeautifulSoup(soup.prettify("utf-16"), "html.parser")

  • @leonardodicaterina7675
    @leonardodicaterina7675 5 років тому +8

    so... those hideous automatic mail bombing advertiser may have their internet security lowered? interesting

    • @cankarkadev9281
      @cankarkadev9281 4 роки тому

      No probably not, you just need to lower your security level if you send mails from your local computer without having a physically real server. If you have one you can just write mail.send or something and the mail is going to be sent as well

  • @caolkyle
    @caolkyle 5 років тому +3

    4.18 “it will never stop. Just like my mental state”

  • @ziinx5899
    @ziinx5899 3 роки тому +4

    Looks like Amazon updated their site. It keeps detecting me as a bot and gives me a different html.

  • @voltaralcala9021
    @voltaralcala9021 4 роки тому

    Your projects are the only ones that I see are productive. Thank you for making these videos.

  • @CharmingData
    @CharmingData 4 роки тому

    Great tutorial. Simple, to the point, useful, and didactic. Thank you,

  • @ArchHyperion
    @ArchHyperion 5 років тому +7

    lol when you set the price to price[0:5], this is bad programming. always do a regex lol. I'm also wondering how the euro symbol disappears in that string splice. when you start at 0, it should get the first character which is the euro symbol right?

    • @yskhcl
      @yskhcl 5 років тому +1

      Or for this specific case, you can find the euro sign and split the string until it, I agree with you man

    • @ArchHyperion
      @ArchHyperion 5 років тому

      @@yskhcl i just find it strange lol.

    • @aravinda513
      @aravinda513 4 роки тому

      I too had the same query!

  • @MostafaKhaled-c8q
    @MostafaKhaled-c8q 5 років тому +8

    please more javascript tutorial

  • @austendeverell436
    @austendeverell436 5 років тому +4

    Theoretically you could observe the stock market using this tactic, and use an alternate email for the amount of emails you get.

  • @danilocecilia7831
    @danilocecilia7831 5 років тому

    subbed! Just came from suggestion by youtube page, and simply loved your content and how you explain! cant wait to see more python videos.

  • @rimini201
    @rimini201 4 роки тому

    Wahey - I just did this and it totally works. Now I need to use Python to automate other aspects of my life... thanks dude!!

  • @tylermcchesney2314
    @tylermcchesney2314 5 років тому +5

    Anyone else have issues with the .get_text() request when he defined title and price?

    • @__-vq9mb
      @__-vq9mb 5 років тому

      Try importing:
      from django.utils.translation import gettext

    • @gamzaify
      @gamzaify 4 роки тому

      Did you find a solution? Getting this as well

    • @kelvinmwongera7320
      @kelvinmwongera7320 4 роки тому

      @@__-vq9mb exactly as you've typed it or what command should we put in the terminal?

  • @kevinat71
    @kevinat71 5 років тому +9

    oh.... this one in javascript should be great

    • @Zihad
      @Zihad 5 років тому

      Coming soon, I guess

    • @Zihad
      @Zihad 5 років тому

      Recorded, I'll be uploading soon 🙂

    • @Zihad
      @Zihad 5 років тому

      ua-cam.com/video/mZHl6wBXO6Y/v-deo.html
      Here you go :P

  • @nauzetmartin325
    @nauzetmartin325 5 років тому +6

    Do you not declare the conditional twice? thanks for your video!!

  • @greaper3180
    @greaper3180 4 роки тому

    1:40 and i liked you already. Subscribed. I like how you talk about programming like it's some magic stuff.

  • @igorstasenko9183
    @igorstasenko9183 5 років тому

    float takes its name from 'floating point number'. float is the way how you store numbers in memory, and surely you can represent 'whole numbers' like 5 using float

  • @anshumanparekh3603
    @anshumanparekh3603 3 роки тому +3

    why does it not work anymore?? it just says none instead of price

    • @sola2943
      @sola2943 6 місяців тому

      I ran into that problem too. I even changed the text to a-price-whole to reflect the page's current format. 🤷

  • @mohamedyusef9174
    @mohamedyusef9174 5 років тому +4

    can you make an app that buys the camera automatically whenever it reach a certain price...is it possible?

    • @sevcandincel
      @sevcandincel 5 років тому +1

      MOHAMED YUSEF i think you can make it whit selenium module. Its use in web automation.

    • @Andrei-rp3dz
      @Andrei-rp3dz 5 років тому

      Yeah but it's better to use Selenium for that. That being said, Amazon might stop you from connecting if you use a headless browser, so try some stuff out.

    • @user-cd6vy2jg6f
      @user-cd6vy2jg6f 5 років тому

      Andrei Lazar if it’s online there’s a way for it to be done. Amazon can do a lot to prevent it, but a determined coder can find away around it. Wether that be scraping the page for the CSRF token and sending that in the header or a hidden form value - its impossible
      To prevent a public page from being used by bots completely

    • @ryankraft9897
      @ryankraft9897 5 років тому

      A friend of mine built a bot that did exactly that. He actually gave it full access to his PayPal credentials to purchase items. It went rogue and it bought some really weird items on its own. It bought a pink selfie stick, winter gloves, and some other totally useless stuff. Too funny.

  • @ommandavia
    @ommandavia 5 років тому +6

    Hey there! Thanks a lot for sharing your knowledge. It helps a lot for students like me to stand apart. :)

  • @venkateshdas5422
    @venkateshdas5422 4 роки тому

    No one has noticed the redundant "if" statement that has been used in the check price function. Other than that I found the video to be very useful and clean . Thanks for the upload!

  • @HotShame0
    @HotShame0 4 роки тому +1

    We can use Regex to extract the price without specifying the elements, because what if the price by magic went down to the 10s or 100s.
    Here's how i would extract it ... x = re.findall("[0-9]+\.?[0-9]*", price) then use float(x)
    i never programmed in python but i learned it from java, and found that the library for regex in python is re.

  • @ronanpeter8657
    @ronanpeter8657 5 років тому +4

    could not convert string to float:(

    • @Jagddish
      @Jagddish 5 років тому

      Mine too! use single quotes converted_price < '1,700' as a string

    • @fadhlulfahmi5125
      @fadhlulfahmi5125 5 років тому +2

      in my case, the output of price variabel is $1,700.00 or something like that,,
      so I make the code like this: converted_price = float(price[1:6].replace(",", "."))
      this will return a float 1.700

    • @abbyboing
      @abbyboing 5 років тому

      @@fadhlulfahmi5125 Even I had to StackOverflow this stuff. Pretty confusing as str_replace() was not working properly but the . operator did the perfect job. You know why str_replace() didn't work? depreciated?

    • @fadhlulfahmi5125
      @fadhlulfahmi5125 5 років тому

      @@abbyboing as far as i know, python use str.replace() not str_replace()

    • @abbyboing
      @abbyboing 5 років тому

      @@fadhlulfahmi5125 maybe str_replace() would've been some old function, as I did see alot of that on stack overflow.

  • @archerplayz1317
    @archerplayz1317 4 роки тому +4

    when ever i use .get text this comes up please help:Traceback (most recent call last):
    File "main.py", line 7, in
    title = soup.find(id="productTitle").get_text()
    AttributeError: 'NoneType' object has no attribute 'get_text'

    • @clank2269
      @clank2269 4 роки тому

      try these out:
      soup = BeautifulSoup(page.content, "html5lib") (you need to install html5lib)
      if this doesnt work use
      New code: soup = BeautifulSoup(page.content, 'lxml')

    • @tinkug2798
      @tinkug2798 4 роки тому +1

      Hi, i tried html5lib as well as lxml. Same error , could you please help.

    • @LaffyToffy
      @LaffyToffy 4 роки тому

      @@tinkug2798 are you finding element by id or class?
      if you are using class use:
      title = soup.find("div", {"class": "_35KyD6"}).get_text()

    • @tinkug2798
      @tinkug2798 4 роки тому

      @Ayush, hey ayush, i am finding by id just like it is shown in the video

    • @tinkug2798
      @tinkug2798 4 роки тому +1

      Thanks Ayush. I think i got the issue it is varying from website to website, i tried on amazon.in same code worked perfectly fine. Amazon.com it is throwing this error .

  • @mcmaker2033
    @mcmaker2033 3 роки тому +4

    It say None our get an error when I print title

    • @elenatarasova9027
      @elenatarasova9027 3 роки тому +1

      I've tried to add the second parameter to headers and it helped "headers = ({'User-Agent':
      'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.157 Safari/537.36',
      'Accept-Language': 'en-US, en;q=0.5'})

    • @mcmaker2033
      @mcmaker2033 3 роки тому

      @@elenatarasova9027 thanks!

  • @tuz6820
    @tuz6820 4 роки тому

    awesome video. i’m gonna use this as a base for practice and make a little web app out of it which allows the user to input an url himself :)

  • @chompitube
    @chompitube 5 років тому +1

    You should check for id="priceblock_dealprice" as well because when amazon put a deal on an item it changes the HTML structure to include original price and the deal price...