Тёмный

Web Scraping Using PHP - Parse IMDB.com Movies HTML 

Clever Techie
Подписаться 102 тыс.
Просмотров 82 тыс.
50% 1

Upgrade your Clever Techie learning experience:
/ clevertechie
UPDATE! (9/13/19) New features and improvements for Clever Techie Patreons:
1. Download full source code with detailed comments - easy to learn and understand code
2. Weekly source code file updates by Clever Techie - every time I learn new things about a topic I will add it to the source file and let you know about the update - keep up with the latest coding technologies
3. Library of custom Clever Techie functions with descriptive, easy to understand comments - skyrocket coding productivity, code more efficiently by using Clever library of custom re-usable functions
4. Syntax code summary - memorize and review previously learned code faster
4. Organized file structure - access all Clever Techie lessons, source code, graphics, diagrams and cheat sheet from a single workspace - no more searching around for previously covered material and source code - save enormous amount of time and effort
5. Outline of topics the source file covers - fast review of all previously learned coding lessons
6. Access to all full HD 1080p videos with no ads
7. Console input examples - interactive examples that make it easier to understand and learn coding
8. Access to updated PHP Programming Book by Clever Techie
9. Early access to Clever Techie videos
Subscribe to Clever Techie patreon:
/ clevertechie
`````````````````````````````````````````````````````````````````````````````````````````````
Using PHP and regular expressions, we're going to parse the movie content of IMDB.com and save all the data in one single array. Web scraping using regex can be very powerful and this video proves it. We account for empty elements by matching groups of HTML blocks, looping through the blocks of matched content and then matching single elements, if they're found from the block. This technique of matching content and web scraping can be used on just about any web site to parse out it's content.
`````````````````````````````````````````````````````````````````````````````````````````````
Hey guys, I'm now using Patreon to share improved and updated video lesson material. For a small fee you can access all the downloadable files from this lesson (source code, icons & graphics, cheat sheets) and everything else included in the video from the Patreon page. Additionally, you will get access to ALL Clever Techie videos in HD format with no ads. Thank you so much for supporting Clever Techie :)
Download this video's files here:
/ web-scraping-php-20819046
This download (Patreon unlock) includes:
(PHP regex function source code, PHP regex screen shots, PHP regex cheat sheet)
+
( You also get access to ALL source code and any downloadable content of ALL Clever Techie videos, as well as access to ALL videos in HD 1080p quality format with all video ads removed! )
`````````````````````````````````````````````````````````````````````````````````````````````
In this web scraping tutorial we’re going to be using regular expressions to parse HTML. This is a more advanced tutorial so you can check out my video on regular expressions before going through this. We’re going to be parsing out the IMDb website, which is an Internet movie database, and I’m going to be using a website called www.regex101.com to test regular expressions against strings to make sure we’re matching them correctly. Because this is an advanced tutorial, I’ll be posting each portion of code and explaining how it works as we walk through it. Directly below is the full source code, but skip down further and I'll walk through each portion of the code.
`````````````````````````````````````````````````````````````````````````````````````````````
( Website ) clevertechie.com - PHP, JavaScript, Wordpress, CSS, and HTML tutorials in video and text format with cool looking graphics and diagrams.
( RU-vid Channel ) / clevertechietube
( Google Plus ) goo.gl/J71p6f - clever techie video tutorials.
( Facebook ) / clevertechie
( Twitter ) / theclevertechie

Хобби

Опубликовано:

 

9 июл 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 76   
@clevertechie
@clevertechie 7 лет назад
Download source code here: clevertechie.com/php/97/web-scraping-php-parse-imdb.com-movies-html
@hanesmitter1469
@hanesmitter1469 5 лет назад
THAT code is not working for me
@8ack2Lobby
@8ack2Lobby 4 года назад
@@hanesmitter1469 you can use mine here it is working fine (Note: changing the page number does not do anything so you need to change the start parameter's value when you wanna goto next page)
@ItsAlkhanza
@ItsAlkhanza 3 года назад
@@8ack2Lobby Thanks for the code
@user-jm6hu4gz7x
@user-jm6hu4gz7x 3 года назад
@@8ack2Lobby can u but in GitHub
@ShawnRitch
@ShawnRitch 9 месяцев назад
@@8ack2Lobby Thank you sir ! ! ! Still works after all these years. Gotta love PHP :)
@anthonymcevans8191
@anthonymcevans8191 6 лет назад
The most useful content I’ve ever ever seen. I definitely will subscribe.
@tanjimrahat9674
@tanjimrahat9674 3 года назад
I feel this channel should have more subscriber than it has. Thumbs up!
@redblue7733
@redblue7733 5 лет назад
Thanks for video and time. Finaly one good yt author.
@andrewmusholt9327
@andrewmusholt9327 5 лет назад
Fun and useful skill!!! Thank you
@chesterleespencer5808
@chesterleespencer5808 2 года назад
It's Enlightening, thank you so much...
@primepryme
@primepryme 6 лет назад
i do love your way of explaining thing
@andrewlong3073
@andrewlong3073 6 лет назад
Hi Clever Techie, thanks for a great video. Just one thing : where does the $match variable come from?
@BorislavJordanov
@BorislavJordanov 4 года назад
You just earned a sub! Love the clarity of your voice. Thanks for all your explanations!
@alexlopusy3744
@alexlopusy3744 5 лет назад
thank so much for your tutorial sir , helps alots
@sudhagars641
@sudhagars641 2 года назад
Nice tutorial, Thanks sir
@groovykeyz9262
@groovykeyz9262 7 лет назад
When I view page source I get a blank page. I don't know why that happens. I have a blank page when I run parse_imdb.php then whenever I call the function scrape_imdb(2000,2000,76,76); and it is loading endlessly
@westjr5085
@westjr5085 7 лет назад
great vid...what about websites with user authentication and load the data from react js?? I have the log in portion but I can load the element data because it is delivered from react
@yusufmzn4541
@yusufmzn4541 6 лет назад
i need an answer for my Question Question : who is better for making movies website HTML or Wordpress?? and i'm learned HTML and CSS and JavaScript
@VivekKumar-br9ie
@VivekKumar-br9ie 6 лет назад
Useful Video
@StoreRunDotCom
@StoreRunDotCom 6 лет назад
so .*? is a wildcard and in parenthesis is the wildcard you want to capture?
@FaceBook-bd3xo
@FaceBook-bd3xo 5 лет назад
hi man/how to parse data from different pages? example.i want to parse content from the main page(date of concert,heading and image) and inner page(when we clicked on the heading we are step up in the inner page) with preambule.
@mehranehsandoost2799
@mehranehsandoost2799 7 лет назад
i have problem with some pages when i use : $ch = curl_init(); curl_setopt($ch,CURLOPT_URL,$url); curl_setopt($ch,CURLOPT_RETURNTRANSFER,True); $res = curl_exec($ch); echo $res; it shows a page like �w�Z�Ѹt���� d what should I do to solve this problem?
@kizitopedro8808
@kizitopedro8808 5 лет назад
Hi I like your previous video though I didnt quite understand how you get the movies from IMDb. But am working on a website for movies and also TV series, so is their any way you can show me how to also add TV series files from IMDb and how it works,like am I to register in IMDb or what please
@kakatoji
@kakatoji 3 года назад
how to scraping and bypassing the recapctha
@nguyenduyquang3533
@nguyenduyquang3533 3 года назад
Can't scan data when the system requires login, what should I do? , look forward to your help
@johnowen-jones6702
@johnowen-jones6702 5 лет назад
Found a couple of issues first is the url needs to be https instead of http, the pagination has changed it now gives 50 results and a second page starts at 51 I made a variable pageblock and then incremented it in the for loop by 50 so 1, 51, 101 not quite perfect but the strange thing is the array is reversed. page 3 is 0-49 page2 50-100 and page 1 is 100 to 150; kind of expected it to fill page1, 2,3, but this is reversed.
@senghortkheang9831
@senghortkheang9831 6 лет назад
Dear Sir, Do you ever scrape data from block JavaScript? Do you have a solution & simple code? Can you help me? I will wait for help from you.
@nazartjara9397
@nazartjara9397 7 лет назад
Why do not you use xpath?
@darylzhang3124
@darylzhang3124 6 лет назад
Could you explain what is the difference between starting with ! and starting with / when I use the regular expression functions of PHP? Because I used preg_match_all('/regular expression/',$result,$matcg) and it worked except the regular expression, '/Directors?: (.*?) /s',used for obtaining the names of directors. Thank you.
@zsoltoroszlany7172
@zsoltoroszlany7172 6 лет назад
Daryl Zhang Think of the ! like quote in between you have your regex, and since you used ! as a barrier you have to escape exclamation mark in your regexp, without this the regexp parser will think your regex ends there. Example you cant do this somethink like this !.+?(.+?)!! you have to escape the \! before
@munauwarm7449
@munauwarm7449 6 лет назад
how can I insert it into database ?
@jcltradingcompany3558
@jcltradingcompany3558 7 лет назад
Hey Clever Techie - From where did you get the regular expression to match with regex101? How could I get that information from any website. ?
@jcltradingcompany3558
@jcltradingcompany3558 7 лет назад
Hey Clever Techie, I went through your Regual Expression Tutorial and understood. Thanks a ton. I was confused before thinking where did you get those regular expression you created.. Your tutorials are simply great.
@mohammedissam3651
@mohammedissam3651 3 года назад
How did you know that they uses php ? IMDb.com they could use c# cus when you load HTML file it doesn’t load backend script with it . Do you find it out with try and error, Or they said that they use php in their website?
@rahulsharma-wy3sy
@rahulsharma-wy3sy 5 лет назад
I tried this but some content is not parsing. Can you please help
@nxson8727
@nxson8727 2 года назад
so i this like a imdb website made with php and html?
@shivam2153
@shivam2153 6 лет назад
I am not getting the required output. Can you tell me what all is required to run this php file for the desired output
@dondada1507
@dondada1507 6 лет назад
Read about xamp, then install it
@foxtechsb6048
@foxtechsb6048 3 года назад
Nice tutorial, Thanks, how to inset scarp data into database table?
@soraya7576
@soraya7576 5 лет назад
i need to know how scheduler crawler parser and indexierer will work... help
@clevertechie
@clevertechie 5 лет назад
I already have videos on all those things you metioned
@mahmoudsamyessawy
@mahmoudsamyessawy 6 лет назад
Thank you very much , but I am afraid you did it the wrong way , I think we have to us a HTML parsing library instead of regex , because regex cann't parse element by element , for example if a movie have no Gross nor Votes and this movie happened to be the last one of the current page (i .e : their is no next ) , how could we get this using the regex , if we us an Html parsing library we could walk movie by movie and parse all its info , any way I enjoyed the video thank you again :)
@GauravSharma-cw1hf
@GauravSharma-cw1hf 2 года назад
The link you provide download source code is not work.
@amadeuszdobies9399
@amadeuszdobies9399 7 лет назад
Regular expressions are always pain in the ass haha :D
@adityarajsingh7617
@adityarajsingh7617 4 года назад
how to get the regular expressions
@terminatortutorials
@terminatortutorials 7 лет назад
I've never seen an attempt to parse XML using a regex that won't break on some content.The real trouble is nested tags.Nested tags are very difficult to handle with regular expressions.If you want to find a very specific pattern in a (ht|x)ml file, go on, regex is perfect for that.But if you are searching for something in in every Foo tag, that could have attributes in different orders, that can be nested, that can be malformed (and still valid), then use a parser, because thats not pattern matching anymore.
@zsoltoroszlany7172
@zsoltoroszlany7172 6 лет назад
Arslan Hajdarevic C# XPath nightmare, it is even worse. Basically everything would be fine if (x)html would be valid.
@NandamuriManikanta
@NandamuriManikanta 7 лет назад
Hey @Clever Tehie how are you making GET calls to imbd webiste and how are you dealing with CORS problem.Please revert TIA
@PeterParker-sy9bp
@PeterParker-sy9bp 7 лет назад
he is not performing a get request. he is performing a curl request and storing what has returned.And it is returning the source code of the given url. you can watch his video on curl.
@shivam2153
@shivam2153 6 лет назад
what all is needed to run this code
@vashantir
@vashantir 5 лет назад
In case a newbie pops in...there's actually 50 elements. Don't forget arrays start at 0.
@mehranehsandoost2799
@mehranehsandoost2799 7 лет назад
thank you for tutorial
@8ack2Lobby
@8ack2Lobby 4 года назад
That code is not working anymore. So, if you need a working one, here it is (NOTE: credit always goes to my Teacher Clever Techie for teaching me all these things). So, enjoy!
@naveshkintali1219
@naveshkintali1219 4 года назад
Brother can you please make a resume parser in Php? There is no resume parser in php....not available on internet and RU-vid. I tried getting on github but nothing is working.. If u make then your video will be unique and most of them needs it. Please make it in php
@TechieUpgrader
@TechieUpgrader 2 года назад
How to scrape amazon prime video website
@amguruprasath8037
@amguruprasath8037 6 лет назад
"Moved Permanently The document has moved here." I get this error.
@thisisnotok2100
@thisisnotok2100 5 лет назад
it matters where you curl to, make sure there are no redirects
@johnjohnson7538
@johnjohnson7538 7 лет назад
Great tutorial, In the regular expression used to collect the titles, at 2:37, you have " '!(.*?)!' " what is the reason for the first '?' That is, why do you start with '!
@clevertechie
@clevertechie 7 лет назад
.*? is non-greedy meaning it will stop when it will encounter the first character which is placed right after it, in this case a double quote. .* is greedy and will go on matching absolutely ANYTHING (spaces, line breaks, ALL the content....) you unleash the cracken with it.
@sergeyz4591
@sergeyz4591 4 года назад
Keep on doing stuff like this because it teaches newbies to write really stupid scrapers.
@chanlito4896
@chanlito4896 6 лет назад
No offense but do yourself a favor and use node for web scraping.
@frosty1433
@frosty1433 6 лет назад
You can't parse [X]HTML with regex. Because HTML can't be parsed by regex. Regex is not a tool that can be used to correctly parse HTML..........
@zsoltoroszlany7172
@zsoltoroszlany7172 6 лет назад
Shea Sollars Tried XPath? I am thinking going with regex too, since XPth is a nightmare in C# believe me, of course maybe there are better tools other tan HtmlAgilityPack, but lets say "hap" follows a strict path to an element and usually results the wrong elemnt altough the XPath is correct.
@aristonia1991
@aristonia1991 2 года назад
This is such overkill IMDB has an api that's all you need...
Далее
Кто то встречал их на улице?
00:59
PHP Regular Expressions Tutorial
14:50
Просмотров 45 тыс.
The Biggest Mistake Beginners Make When Web Scraping
10:21
Scrape Websites with Regular Expressions
10:51
Просмотров 8 тыс.
Web Scraping PHP Simple HTML DOM Parser 2023 Day 1
10:20
Website Vulnerabilities to Fully Hacked Server
19:50
Просмотров 143 тыс.
PHP Web scraping
11:34
Просмотров 5 тыс.
Always Check for the Hidden API when Web Scraping
11:50
Жалко Кирилла? #юмор #шутка
1:00