downthemall / anticontainer

DownThemAll! AntiContainer (Extension to a Firefox, Seamonkey extension)
Mozilla Public License 2.0
93 stars 41 forks source link

vk.com gallery anticontainer #117

Closed marcellog closed 7 years ago

marcellog commented 8 years ago

Hi, I'm new here and not sure if i should write an issue or pull request. I believe it's both, anyway, I've been trying to code a plugin for vk galleries, but I think it needs more coding knowlegde than i can "handle", like a sandbox (what I think could have a more extensible documentation on how to write one as I didn't figured it out yet...:)

When studying the vk source code, these are the notes of what i found:

Someone's profile:

https://vk.com/someoneprofile

The photos page from the profile page: https://vk.com/albums981740893?profile=1 The number after "albums" I typed aleatorialy, as an example.

An album's page, from the photos page: https://vk.com/albums981740893_188761570

The link to the picture: https://vk.com/photo2945771_311530175

The picture url: https://pp.vk.me/c616422/v616422577/703/pIcTuRe.jpg

When debugging the page, you can find the picture url at these two parts:

1: <div style="display: none; left: 22px; top: 12px;" id="pv_tag_frame"><img style="width: 604px; height: 402px;" src="https://pp.vk.me/c616422/v616422577/703/pIcTuRe.jpg"></div> 2: <a style="height: 402px;" onmouseout="Photoview.hideTag()" onmousedown="if (!cur.pvTagger &amp;&amp; checkEvent(event) === false) return Photoview.show(false, cur.pvIndex + 1, event);" onselectstart="return cancelEvent(event);" onclick="return checkEvent(event)" href="/photo2945771_311530175" id="pv_photo"><img style="width: 604px; height: 402px; margin-top: 0px;" src="https://pp.vk.me/c616422/v616422577/703/pIcTuRe.jpg"></a>

But they use an ajax process (i believe, not sure) that loads the picture page inside a div, which i think makes the anticontainer unabble to find the picture url.

I then looked at the page source code, and saw that the page has a script that loads the urls from certain amount of pictures near the selected one, with the selected one. There are some regex kind of mixed there, i didn't fully understand... but all pictures urls are written after "_src:" with backslashes before the dots, like vk\.com (if i remember well). Then i wrote a regex to take out the backslashes and thought it could be in the finder field, like this: “finder”: “_src\”:\”(.+?[^\\])\””,

I wrote some json files, some quite simple enough not to work...

Here are some of them:

{
"type": "resolver",
"prefix": "vk.com",
"match": "^https://(www\\.)?vk\\.com/photo(.+?)",
"finder": "https:\"(.+?[^\\])\"",
"builder": "{1}",
"static": false
}

And the one above, with other "finder"s:

"finder": "style=\"width: (.+?); height: (.+?); margin-top: 0px;\" src=\"(.+?)\"",
"finder": "id=\"pv_open_original\" href=\"(.+?)\"",
"finder": "\"z_src\":\"https:\"(.+?[^\\])\"\" \"photos_pv_act_open_original\":\"Open original\"",

but none of them worked... although the two last ones are more like to work. I wish i could get some help, or request a new one, which is even better!

Thanks in advance.