![]() |
|
[C#] Instagram Private/Public Photo Scraper - Printable Version +- Hack Forums (https://hackforums.net) +-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444) +--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151) +---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118) +---- Thread: [C#] Instagram Private/Public Photo Scraper (/showthread.php?tid=5768296) |
Instagram Private/Public Photo Scraper - Decim - Dec 14, 2017 Scrape photos off public and private Instagram profiles. ![]() Note: Scraping private profiles require you to login with an account that follows the user. Sauce: https://github.com/arcanecfg/Instagram-Private-Scraper RE: Instagram Private/Public Photo Scraper - inyourmemory - Dec 14, 2017 Nice release appreciated, thanks!!! RE: Instagram Private/Public Photo Scraper - Pi-ka - Dec 14, 2017 Thanks Arcane ❤️ You‘re teh man, appreciate that you share the source. RE: Instagram Private/Public Photo Scraper - itcorp - Dec 14, 2017 Continue with good posts...this is really good share RE: Instagram Private/Public Photo Scraper - Ninja - Dec 14, 2017 Here is my 2 cents. This is in no way meant to bring you down. I love the contribution and I want to help you learn and improve, so please takes this the positive way. The constant class contains global constants. This is not necessarily bad, but there is more info on why to avoid global variables here. This applies a bit to static variables/classes as well. This makes no sense. You are saying: if whatever = true return true if false return false. why not return the condition instead? Saves 4 lines of code. And consider using using statements instead, as they tend to look cleaner, and because if an exception is thrown in your code than the object is not disposed. You could also solve this with a finally block after the catch. More info on the using block here. More info on the finally block and disposing here. The account class; making everything public and static, and not using properties can be considered bad practice by many. If you want to expose a field publicly, then use a property. And by not making it static you could drag and drop the account class and the login function from the other class in another project and get going right away, without needing to modify much. More info on auto-properties here and here. In the main class you have a huge function called FetchPosts. This is also bad practice, as if you want to follow OOP strictly, you should segment functionality. Have functions/classes solely for one responsibility (single responsibility principle). This will make the code easier to read and maintain and debug. There is a general, unwritten, rule of thumb; functions cannot be larger than your screen size. More info on the SOLID principles here. You use multiple WebClient instances, and never dispose them. You could have declared one single WebClient in the class so that every function can utilize it (except when threading). And for threading, everytime you download a picture you declare a new WebClient instance and never dispose of it. Consider giving each thread its own WebClient instance that they can re-use. Deserializing JSON to dynamics, when done quite often, decreases performance as dynamics have an overhead. Consider using a website like json2csharp that converts the json to classes for you, or use the Special Paste option in Visual Studio to do the same. It will generate a RootObject and all other necessary classes, and you can then deserialize the JSON to the RootObject. If you have a lot of classes (when handling large JSON for example), just group them all together in a single .cs file. You parse text from the JSON, and then deserialize part of the JSON. Why not deserialize all of it and then get what you need from the class instances it returns? And finally, booleans by default are false when instantiated (unless you set them to true when instantiating). So "bool flag = false;" can be shortened to "bool flag;". RE: Instagram Private/Public Photo Scraper - eithan1231 - Dec 15, 2017 Code if (HTTPMethods.POST("username=" + InstagramAccount.username + "&password=" + InstagramAccount.password, InstagramAccount.cookies, csrfToken, "\"authenticated\": true", Constants.Referer))Use URL encoding. RE: Instagram Private/Public Photo Scraper - Decim - Sep 2, 2018 The pagination is now broken after an Instagram update. The /?__a=1&max_id=end_cursor is deprecated. If anyone knows how the new pagination works, feel free to update this. RE: Instagram Private/Public Photo Scraper - champagnpapi - Sep 2, 2018 The thing is you can't name this a private account scrapper,if i had an account following it then it'd be easy,so just call it a public account scrapper :P RE: Instagram Private/Public Photo Scraper - HFDone - Sep 3, 2018 check https://stackoverflow.com/a/49341049 RE: Instagram Private/Public Photo Scraper - Decim - Sep 4, 2018 (Sep 3, 2018 12:04 PM)HFDone Wrote: check https://stackoverflow.com/a/49341049 I already figured out that endpoint, but the 'queryhash' value remains constant for sometime and varies after a while. RE: Instagram Private/Public Photo Scraper - HFDone - Sep 4, 2018 media - query_hash=298b92c8d7cad703f7565aa892ede943 https://github.com/mineur/instagram-parser/blob/master/docs/setup.md#how-to-get-your-query-hash-old-query-id RE: Instagram Private/Public Photo Scraper - Decim - Sep 10, 2018 (Sep 4, 2018 10:28 AM)HFDone Wrote: media - query_hash=298b92c8d7cad703f7565aa892ede943 That's cool, but it's still part of the querystring. Is it possible to grab it programmatically? RE: Instagram Private/Public Photo Scraper - He B TeMy - Sep 10, 2018 Not trying to disregard your project but instaloader exists for a reason and is actively maintained, https://github.com/instaloader/instaloader I just wished there would be something like that for facebook, piece of crap website RE: Instagram Private/Public Photo Scraper - HFDone - Sep 12, 2018 (Sep 10, 2018 03:17 AM)Decim Wrote: That's cool, but it's still part of the querystring. Is it possible to grab it programmatically? if you login using cookie and form data you should be good the query looks like https://www.instagram.com/graphql/query/?query_hash=298b92c8d7cad703f7565aa892ede943&variables={"tag_name":"tag_name","first":12,"after":"end_cursor"} if you not login you will get error |