View Single Post
  #33  
Old 06.01.2020, 06:07
tony2long's Avatar
tony2long tony2long is offline
English Supporter
 
Join Date: Jun 2009
Posts: 6,391
Default

Quote:
Originally Posted by zmv View Post
The thing is Instagram generates different html depending on whether you are logged in or not. If you are not then the links to media files can be found in json node entry_data/PostPage where the decrypter will find them. However if you log in this node will be empty, the decrypter will find nothing. The media links will be instead in a separate json in another <script> tag.
You can easily fix this issue by checking if the user is logged in and if he is parsing the content of this tag.

Code:
if (parameter.matches(TYPE_GALLERY)) {
            /* Crawl single images & galleries */
            if (logged_in) {
                String graphql = br.getRegex(">window\\.__additionalDataLoaded\\('/p/[^/]+/'\\s*?,\\s*?(\\{.*?)\\);</script>").getMatch(0);
                entries = (LinkedHashMap<String, Object>) JavaScriptEngineFactory.jsonToJavaObject(graphql);
                resource_data_list = new ArrayList<>();
                resource_data_list.add(JavaScriptEngineFactory.walkJson(entries, "/"));
            } else {
                resource_data_list = (ArrayList) JavaScriptEngineFactory.walkJson(entries, "entry_data/PostPage");
            }
            for (final Object galleryo : resource_data_list) {
Thanks for your contribution, I have updated the plugin with your codes.
@all, please check updates, test and confirm.
__________________
FAQ: How to upload a Log
Reply With Quote