Part 5. Collections.
Now we will add collections to our scraper. First create src/WebmasterHacks/VideoCollection.php file with this content:
<?php
namespace WebmasterHacks\Pornhub;
class VideoCollection
{
protected $videos = [];
public function add(Video $video)
{...
Part 4. Refactor.
OK. Our scraper works already, but there is lot to improve. First of all let's see what we have done.
We have Video object that represents video page. You can ask for data and it will return it.
We have Pornstar object that represents... well pornstar page(s). You can...
Part 3. Porn star page.
Now we know how to scrape data from video page URL. It's time to parse those URLs. Let's start with porn star page.
$client = new Client;
$crawler = $client->request('GET', 'dirtysite/pornstar/madison-ivy');
$urls = $crawler->filter('.videos .videoblock .title...
Yes, thats true. I really don't know skill level of readers, that's why I'm skipping some parts. But I will keep in mind that this can be a problem. That's why feedback is so important. Mby will do some additional part about CSS selectors.
This is the next step :D I'm just checking if someone...
Part 2. Video page.
We already know how to get title from page, let's scrape everything else.
Porn stars... If you open your browser's developer tools you will see that porn stars links are inside element with class "video-info-row" and it contains "Pornstars" word. Also there are...
Started tutorial in "PHP & Perl" category. I don't think it belongs in "Making Money". It's not a method on how to get rich. Just a little tips about developing tools. But you can move it anywhere you want :D
Part 1. Composer.
We will use Composer for dependency management.
Why the hell you need to reinvent the wheel, then there is a lot of great libraries, that was used and tested by thousands of people?
Even better! We will just say which libraries we need and Composer will download them for us...
Hello BHW community!
Today I'm gonna show you how to scrape (parse) web pages using PHP. As an example I choose PornHub :)
Why?
1. A lot of people using content from adult websites for their projects.
2. It's a really good example for parsing. They have video page, categories, tags...
Does anyone has any suggestions about website I could scrape? Of course for the sake of example we can parse BHW users Skype accounts, but I think it would be better to write something useful.
Hi everyone!
I am a web developer and I want to share few tips and tricks with BHW community.
As I saw on this forum sometimes people have troubles with automating their job. There are a lot of different solutions, but they are not equally good. I can show you ways of developing good...
You can use build-in filter_var function.
<?php
if (!filter_var($subject, FILTER_VALIDATE_URL)) {
$error_message .= 'The url you entered does not appear to be valid.<br />';
}
P.S. JavaScript validation is not used for security, it just helps user to see what's wrong...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.