Parcing Instagram comments on php through mobile proxy
1) the url page with the publication ( can be the ordinary publication https://www.instagram.com/p/CiuinbUocPa/ can be reel https://www.instagram.com/reel/CjEA_rRKbFE/ - before they were nothing but url)
2) IP and login password of the mobile proxy (socks5 with login password authorization), which will be used to parsing comments from the publication
3) the number Instagram ID of the user, the comments from which you need to get (there may be several comments from the user there)
Or the API service with similar functions, which will check to present the indicated information and give a response.If there are comments under the publication from the user with the indicated number ID - on the output of the function of the masses with the following data:
-Unix time of the latest comment from this user
- in fact comment in the unicode (precedently the cyrillic and emoji were given in the unicode, so I continue to work with them on my own, scatter)
- login Instagram of this user (login they sometimes change, I keep it in the base and compare that was, with what is at the moment, if the user has changed the login - I update at me in the base these data)
If no comment is found, the corresponding answer.For general understanding how it worked with me before:
Function of getting a page with Instagram publication:
// $proxy_type -proxy type, but recently I only use sox5 with login and password authorization
function getinsta($url, $proxy_ip, $proxy_pass, $proxy_type) {
$chs = curl_init
curl_setopt($chs, CURLOPT_URL, 'https://www.instagram.com/'.$url.‘/’ )
$user_agent = "Mozilla/5.0 (Linux; Android 7.1.2; AFTMM Build/NS6265; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/70.0.3538.110Mobile Safari/537.36”;
curl_setopt($chs, CURLOPT_USERAGENT, $user_agent);
if($proxy_type = 55) {
curl_setopt($chs, CURLOPT_PROXYTYPE, CURLPROXY_SOCKS5); curl_setopt($chs, CURLOPT_PROXY, $proxy_ip); curl_setopt($chs, CURLOPT_PROXYUSERPWD, $proxy_pass); }
if($proxy_type == 1) { curl_setopt($chs, CURLOPT_PROXYTYPE, CURLPROXY_HTTP); curl_setopt($chs, CURLOPT_PROXY, $proxy_ip); }
if($proxy_type == 4) { curl_setopt($chs, CURLOPT_PROXYTYPE, CURLPROXY_SOCKS4); curl_setopt($chs, CURLOPT_PROXY, $proxy_ip); }
if($proxy_type == 5) { curl_setopt($chs, CURLOPT_PROXYTYPE, CURLPROXY_SOCKS5); curl_setopt($chs, CURLOPT_PROXY, $proxy_ip); }
curl_setopt ($chs, CURLOPT_HEADER, true)
curl_setopt($chs, CURLOPT_TIMEOUT, 10);
curl_setopt($chs, CURLOPT_CONNECTTIMEOUT, 10);
curl_setopt ($chs, CURLOPT_FOLLOWLOCATION, true)
curl_setopt($chs,CURLOPT_RETURNTRANSFER,1)
$answer = curl_exec($chs); return $answer; curl_close($chs); }
Next – because.I had little trouble with making regular expressions.
// page modification - replaced by number 1537 part of the source code
$scrap_page = preg_replace('/(\",\"created_at\"\:)/', 'scrup1537', $getpage);
// regular to search for the user's Instagram ID comment from which I'm looking
The variable $iid is the same number id
if (preg_match_all('(id\"\:\"[0-9]{10,25}\",\"text\"\:\")([^@ibh#]{1,9000}(\ibh1537)([0-9]{5,10})(\,\"did_report_as_spam\"\:false\,\"owner\"\:{\"id\"\:\")('.$iid.([^@]{1,500}) (username\"\:\) ([a-z_.0-9]{1,30})/',$scrap_page, $doarray) > 0) {
The user's last comment time with this idy
$time_array = $doarray['4']; $created = array_pop($time_array);
The comment itself
$text_array = $doarray['2']; $raw_comment = array_pop($text_array);
// login Instagram user with this idy
$loginii_array = $doarray['9']; $new_ilogin = array_pop($loginii_array);
The
by P.S. I use the mobile proxy with the switch of the IPI, because.When applying to Instagram without authorization - he after 3-4 requests begins to ask for authorization (and authorization in the instance I did not at the time, went on the way of using a large number of ip for requests).
-
127 I don’t know how in this task, but it might be interesting if I make a similar app on Android with the same functionality.
Current freelance projects in the category PHP
Transfer the fully ready adaptive HTML5 structure to WordPress.
268 USD
I am looking for an experienced WordPress developer who can convert our meticulously prepared static HTML5/CSS3 code into a high-performance custom WordPress theme. The frontend is almost ready (about 99%): semantic markup, metadata, and multilingual structure (hreflang) are… Content Management Systems, PHP ∙ 1 hour 23 minutes back ∙ 22 proposals |
GoPos IntegrationHello, has anyone done an integration of GoPos with a custom website for a restaurant in Poland? I need help, their documentation is very sparse, there is only swagger and it lacks descriptions. https://app.gopos.io/doc/swagger-ui/index.html The essence is this: we used their… PHP, Web Programming ∙ 17 hours 17 minutes back ∙ 18 proposals |
Write meta data for ALT using AIA website on Laravel, the site has many images for which it is necessary to automatically generate correct semantic and relevant ALT descriptions for the images, with the possibility of verification. AI & Machine Learning, PHP ∙ 1 day 14 hours back ∙ 32 proposals |
A developer is needed to complete and integrate a project for automatic data collection and processing.
16 USD
The main part of the parser has already been implemented. The parser works in a Windows environment through Microsoft Edge: the site has anti-bot protection, so data collection is performed not through direct HTTP requests, but through a live browser session. The scripts control… PHP, Web Programming ∙ 1 day 20 hours back ∙ 24 proposals |
Updating plugins and themes for the WP site putevka.uz"A technical audit of the WordPress site needs to be conducted, checking the relevance, security, and compatibility of the installed plugins and theme. Based on the results, legal options for updating, replacing outdated solutions, or transitioning to officially available… HTML & CSS, PHP ∙ 1 day 23 hours back ∙ 40 proposals |