Найти - Пользователи
Полная версия: Строковые методы?
Начало » Python для новичков » Строковые методы?
1
Deryagtev
Python 3.4 Win 10
Есть текст. В этом тексте за “code”:" идёт собственно код, который мне нужно изъять. Таких кодов 32-33 в тексте, а методы, которые мне удалось найти возвращают номера первого/последнего вхождения. Скорее всего есть какой-то более подходящий метод, но я его не нашёл и решил сделать так.
1) Получить точное количество повторений ключевого слова в тексте(32 или 33) с помощью
s.count('"code":"')
2) Далее получить номер первого вхождения Find или Index и присвоить его i.
3) Создать цикл, который будет работать 32 или 33 раза (j)
4) В цикле находить номер уже второго вхождения(первое мы нашли) ввода дополнительных параметров в find или index f = likeforlike.find('“code”:"',start=i+1,end=len(likeforlike)), то есть вроде как первый параметр учитываться не будет и так далее
Получаю ошибку: find() takes no keyword arguments на строке выше.
Вот весь код:
g.setup()
likeforlike = g.go('https://www.instagram.com/explore/tags/likeforlike/')
likeforlike = likeforlike.body.decode()
j = likeforlike.count('"code":"')
i = likeforlike.index('"code":"')
j=j-1
while j>0:
    f = likeforlike.find('"code":"',start=i+1,end=len(likeforlike))
    print(f)
    j=j-1

Пример текста
FishHook
Да это же JSON, нафиг вам со строками работать? Сделайте json.loads и не мучайтесь.
Deryagtev
FishHook
Да это же JSON, нафиг вам со строками работать? Сделайте json.loads и не мучайтесь.
Спасибо за ответ, к сожалению никогда не работал с JSON, погуглил и, честно говоря, не очень понял, попытался скопировать текст между тегами <script> на странице и тупо впихнуть в json.loads('сюда'), естественно словил кучу ошибок.
Я подумал, раз это не основная моя идея и работа, я могу вникнуть в сам JSON потом, а сейчас могу воспользоваться готовым решением, если у вас будет время. Итак, что мне нужно сделать?
window._sharedData = {"country_code":"BY","language_code":"ru","gatekeepers":{"cpp":true,"rhp":true,"addpp":true,"sfbf":true},"static_root":"\/\/instagramstatic-a.akamaihd.net\/bluebar\/abdffdf","platform":"web","hostname":"www.instagram.com","entry_data":{"TagPage":[{"__query_string":"?","__path":"\/explore\/tags\/likeforlike\/","tag":{"media":{"count":155998963,"page_info":{"has_previous_page":false,"start_cursor":"1163236085083113763","end_cursor":"1163236050903226841","has_next_page":true},"nodes":[{"code":"BAkpQ3TpOB7","date":1452888568.0,"dimensions":{"width":320,"height":320},"comments":{"count":0},"caption":"\ud83d\udc4d #followme #like4like #top #liker #likes #l4l #likes4likes #photooftheday #love #likeforlike #likesforlikes #100likes #liketeam #likeback #likebackteam #instagood #likeall #likealways #liking #swag #fun #instalike #iphone #instafresh #igers #iphoneonly #20likes #50likes #likeme #likesback","likes":{"count":0},"owner":{"id":"1222359"},"thumbnail_src":"https:\/\/scontent-waw1-1.cdninstagram.com\/hphotos-xaf1\/t51.2885-15\/e35\/917555_171135743248845_400091948_n.jpg","is_video":false,"id":"1163236082572386427","display_src":"https:\/\/scontent-waw1-1.cdninstagram.com\/hphotos-xaf1\/t51.2885-15\/s320x320\/e35\/917555_171135743248845_400091948_n.jpg"},{"code":"BAkpQ0ZKdH6","date":1452888568.0,"dimensions":{"width":1080,"height":1339},"comments":{"count":0},"caption":"Don Corleon x Rolls Royce \ud83c\udfa8 \n#NYC #Miami #London #Paris #Fashion #luxury #exclusive #party #amazing #business #like4like #likeforlike #l4l #lforl #suit #milano #dubai #ferrari #lamborghini","likes":{"count":0},"owner":{"id":"2591827675"},"thumbnail_src":"https:\/\/scontent-waw1-1.cdninstagram.com\/hphotos-xfa1\/t51.2885-15\/s640x640\/sh0.08\/e35\/c0.129.1080.1080\/12479491_1045634522166104_109219342_n.jpg","is_video":false,"id":"1163236079443759610","display_src":"https:\/\/scontent-waw1-1.cdninstagram.com\/hphotos-xfa1\/t51.2885-15\/e35\/12479491_1045634522166104_109219342_n.jpg"},{"code":"BAkpQywt7Ct","date":1452888568.0,"dimensions":{"width":1080,"height":1080},"comments":{"count":0},"caption":"caption this'\ud83d\udc8d\n- #comment #comment4comment #commentforcomment #r4r #share #pleaselike #followher #follow4follow #likeitup #50likes #spam4spam #like #spam #followforfollow #followall #shoutout #100likes #likeforlike #200likes #f4f #pleasefollowme #like4like #followme #likeforlikes #followback #100followers #60likes #likeforfollow #follow4like #likeforfollowback -","likes":{"count":0},"owner":{"id":"2246653563"},"thumbnail_src":"https:\/\/scontent-waw1-1.cdninstagram.com\/hphotos-xtf1\/t51.2885-15\/s640x640\/sh0.08\/e35\/12530803_1094842917215344_1995205909_n.jpg","is_video":false,"id":"1163236077691449517","display_src":"https:\/\/scontent-waw1-1.cdninstagram.com\/hphotos-xtf1\/t51.2885-15\/e35\/12530803_1094842917215344_1995205909_n.jpg"},{"code":"BAkpQyYNRs6","date":1452888568.0,"dimensions":{"width":750,"height":750},"comments":{"count":0},"caption":".\n.\n.\n.\n.\n#likes#like4like#likeforlike#likee#like4follow#followme#nyc#toronto#tagsforlikes#tagsforfollow#spamforspam#igers#vsco#vscocam#instalike#way2kill#polishgirl#polishboy#instafood#instagay#instadaily#instagood#livewild#livefolk#liveauthentic#grunge#instagramnyc#uuonyou#ulzzanggirl","likes":{"count":0},"owner":{"id":"296758397"},"thumbnail_src":"https:\/\/scontent-waw1-1.cdninstagram.com\/hphotos-xpa1\/t51.2885-15\/s640x640\/sh0.08\/e35\/12357642_1675849282695035_660279069_n.jpg","is_video":false,"id":"1163236077280238394","display_src":"https:\/\/scontent-waw1-1.cdninstagram.com\/hphotos-xpa1\/t51.2885-15\/s750x750\/sh0.08\/e35\/12357642_1675849282695035_660279069_n.jpg"},{"code":"BAkpQvBua6W","date":1452888567.0,"dimensions":{"width":480,"height":480},"comments":{"count":0},"caption":"COMMENT TOO OR DON'T RETURN \ud83c\udf65\ud83d\udca7\ud83c\udfa0 #uglyfollowtrain #like4like #cashfollowtrain #follow4follow #gainpost #followtrain #justinbieber #nightgain #tagsforlikes #drake #onedirection #arianagrande  #spam #spam4spam #selenagomez #spamforspam #likeforlike #uglyfollowtrain #fthere #selenagomez #5sos #nickiminaj  #sfs #pll #screamqueens #shaymitchell #ashleybenson #troianbellisario #lucyhale #fthere #gainpost #gangpost #desflopfthere","likes":{"count":0},"owner":{"id":"1335238690"},"thumbnail_src":"https:\/\/scontent-waw1-1.cdninstagram.com\/hphotos-xat1\/t51.2885-15\/e35\/917457_1552312105088940_1424882543_n.jpg","is_video":false,"id":"1163236073681825430","display_src":"https:\/\/scontent-waw1-1.cdninstagram.com\/hphotos-xat1\/t51.2885-15\/s480x480\/e35\/917457_1552312105088940_1424882543_n.jpg"},{"code":"BAkpQqrnCFT","date":1452888567.0,"dimensions":{"width":1080,"height":1080},"comments":{"count":0},"caption":"#tumblr #tumblrpic #tumblrgirl #vscocam #vscostyle #plantsarefriends #tagsforlikes #likeforlike #like4like #tagforlike #tumblrgirl #picoftheday #sfs #f4f #plants #aloe #edit #collage #art #teen #teenager #teenagers #weareteenagers #syber #syberpunk #90s #90style #green #likeformub #fff","likes":{"count":0},"owner":{"id":"1702926799"},"thumbnail_src":"https:\/\/scontent-waw1-1.cdninstagram.com\/hphotos-xfp1\/t51.2885-15\/s640x640\/sh0.08\/e35\/12407352_231451173853077_105710267_n.jpg","is_video":false,"id":"1163236069015822675","display_src":"https:\/\/scontent-waw1-1.cdninstagram.com\/hphotos-xfp1\/t51.2885-15\/e35\/12407352_231451173853077_105710267_n.jpg"},{"code":"BAkpQqABuNd","date":1452888566.0,"dimensions":{"width":750,"height":750},"comments":{"count":0},"caption":"#murmansk #beautiful#follow #followme#follow4follow #like4like#likeforlike#amazing #weekend#Russia#travel #instalike#instafollow #holiday #pic #picoftheday#\u0432\u044b\u0445\u043e\u0434\u043d\u044b\u0435 #\u0434\u0435\u043a\u0430\u043d\u0442\u0435#instacool#instamood#\u0433\u043e\u0441\u0442\u0438#\u0434\u0440\u0443\u0437\u044c\u044f#\u043c\u0443\u0440\u043c\u0430\u043d\u0441\u043a #\u0440\u043e\u0436\u0434\u0435\u0441\u0442\u0432\u043e#cristmas","likes":{"count":0},"owner":{"id":"1121455439"},"thumbnail_src":"https:\/\/scontent-waw1-1.cdninstagram.com\/hphotos-xtp1\/t51.2885-15\/s640x640\/sh0.08\/e35\/916052_527912040709552_1742676778_n.jpg","is_video":false,"id":"1163236068284621661","display_src":"https:\/\/scontent-waw1-1.cdninstagram.com\/hphotos-xtp1\/t51.2885-15\/s750x750\/sh0.08\/e35\/916052_527912040709552_1742676778_n.jpg"},{"code":"BAkpQp8tmEP","date":1452888566.0,"dimensions":{"width":1080,"height":1350},"comments":{"count":0},"caption":"Sunshine and Smiles \ud83d\ude00\n#hawaii #swing #happiness #mylove #ocean #mua #workflow #sahm #entrepreneur #park #foodporn #followforfollow #like4like #likeforlike #r4r #f4f #blessed #family #iphone #sunshine #baby #l4l","likes":{"count":0},"owner":{"id":"2040158479"},"thumbnail_src":"https:\/\/scontent-waw1-1.cdninstagram.com\/hphotos-xpa1\/t51.2885-15\/s640x640\/sh0.08\/e35\/c0.135.1080.1080\/12558558_1639936096255885_1731264449_n.jpg","is_video":false,"id":"1163236068229013775","display_src":"https:\/\/scontent-waw1-1.cdninstagram.com\/hphotos-xpa1\/t51.2885-15\/e35\/12558558_1639936096255885_1731264449_n.jpg"},{"code":"BAkpQpCijy5","date":1452888566.0,"dimensions":{"width":640,"height":640},"comments":{"count":0},"caption":"LIKE AND COMENT \n#fthere #gainpost #likes #like4like #likeforlike #like4likes #likeforlikes #follow4follow #love #amazing #recent4recent #recentforrecent #justinbieber #arianagrande #demilovato #jessiej #heartbeats #taylorswift #katyperry #fthere #desflopfthere #gainpost #gainlikes #likesforlikes #likeforlike #like #likes #spamforspam #like4like #likeback #gains #fthere #desflopfthere #gainpost #gainlikes #likesforlikes #likeforlike #like #likes #spamforspam #like4like #likeback #gains #desflop #desflopfthere","likes":{"count":0},"owner":{"id":"1959080654"},"thumbnail_src":"https:\/\/scontent-waw1-1.cdninstagram.com\/hphotos-xaf1\/t51.2885-15\/s640x640\/sh0.08\/e35\/12547423_1015760855133713_1499985133_n.jpg","is_video":false,"id":"1163236067253042361","display_src":"https:\/\/scontent-waw1-1.cdninstagram.com\/hphotos-xaf1\/t51.2885-15\/s640x640\/sh0.08\/e35\/12547423_1015760855133713_1499985133_n.jpg"},{"code":"BAkpQnmIP9O","date":1452888566.0,"dimensions":{"width":750,"height":501},"comments":{"count":0},"caption":"#\u0434\u043e\u043c\u0430\u0448\u043d\u044f\u044f\u043f\u044f\u0442\u043d\u0438\u0446\u0430\ud83d\udc9e \n#likeforlike #likeforlikes #likeforfollow #likeforlikealways #likeforlikeback #sdv #love #trocolikes #like4like #instagood #followback #follow #me #l4l #followmeplease #followfollowfollow #cute #tagsforlikes #segue #followforlike #liking #likefortags #followfollowfollow #beautiful #likeforshoutout #likeforcomment #followme #likeforlike #like4follow #follow4follow","likes":{"count":0},"owner":{"id":"708977110"},"thumbnail_src":"https:\/\/scontent-waw1-1.cdninstagram.com\/hphotos-xap1\/t51.2885-15\/s640x640\/sh0.08\/e35\/c178.0.720.720\/1922015_211015565907592_1494067700_n.jpg","is_video":false,"id":"1163236065702641486","display_src":"https:\/\/scontent-waw1-1.cdninstagram.com\/hphotos-xap1\/t51.2885-15\/s750x750\/sh0.08\/e35\/1922015_211015565907592_1494067700_n.jpg"},{"code":"BAkpQlXysj0","date":1452888566.0,"dimensions":{"width":750,"height":937},"comments":{"count":0},"caption":"Mi ange, mi d\u00e9mon. \u26a1\ufe0f #instagood #instapic #instaphoto #picoftheday #ootd #hairs #girl #likeforlike #follow #followme #diable #angel","likes":{"count":0},"owner":{"id":"2555769785"},"thumbnail_src":"https:\/\/scontent-waw1-1.cdninstagram.com\/hphotos-xap1\/t51.2885-15\/s640x640\/sh0.08\/e35\/c0.112.900.900\/12407352_478499555670175_313810059_n.jpg","is_video":false,"id":"1163236063314626804","display_src":"https:\/\/scontent-waw1-1.cdninstagram.com\/hphotos-xap1\/t51.2885-15\/sh0.08\/e35\/p750x750\/12407352_478499555670175_313810059_n.jpg"},{"code":"BAkpQlQEIw4","date":1452888566.0,"dimensions":{"width":750,"height":937},"comments":{"count":0},"caption":"Gorrito lindo\u2764\ud83d\ude1d#instalike#feliche#instainsta#instaphoto#instasigueme#siguemeytesigo#instasigueme#instalinares#instachile#instagood#instacool#likelike#likeforlike#like4like#l4l#follow#followforfollow#follow4follow#f4f#picoftheday#photooftheday#cute#chilegram#tagsfortag#tagsforlikes","likes":{"count":0},"owner":{"id":"1257286058"},"thumbnail_src":"https:\/\/scontent-waw1-1.cdninstagram.com\/hphotos-xpa1\/t51.2885-15\/s640x640\/sh0.08\/e35\/c0.120.960.960\/12424801_456875924517255_1997162497_n.jpg","is_video":false,"id":"1163236063184981048","display_src":"https:\/\/scontent-waw1-1.cdninstagram.com\/hphotos-xpa1\/t51.2885-15\/sh0.08\/e35\/p750x750\/12424801_456875924517255_1997162497_n.jpg"},{"code":"BAkpQjTMk_X","date":1452888566.0,"dimensions":{"width":320,"height":240},"comments":{"count":0},"caption":"\u00af\\_(\u30c4)_\/\u00af\u00af\\_(\u30c4)_\/\u00af\n\u25cf\u25cf\u25cf\u25cf\u25cf\u25cf\u25cf\u25cf\u25cf\u25cf\u25cf\u25cf\u25cf\u25cf\u25cf\u25cf\u25cf\u25cf\u25cf\u25cf\u25cf\n#like #instalike #follow #followme #instagood #insta #instagram #instafollow #instapic #instafit #instagramers #wtf #lol #wow #likeforlike #line #\u0432\u0437\u0430\u0438\u043c\u043d\u0430\u044f\u043f\u043e\u0434\u043f\u0438\u0441\u043a\u0430 #\u0432\u0437\u0430\u0438\u043c\u043d\u044b\u0435\u043b\u0430\u0439\u043a\u0438 #\u0432\u0437\u0430\u0438\u043c\u043d\u043e #\u043b\u0430\u0439\u043a #\u0438\u043d\u0441\u0442\u0430 #\u043f\u043e\u0434\u043f\u0438\u0441\u043a\u0430 #\u043f\u043e\u0434\u043f\u0438\u0441\u043a\u0430\u043d\u0430\u043c\u0435\u043d\u044f \u25cf\u25cf\u25cf\u25cf\u25cf\u25cf\u25cf\u25cf\u25cf\u25cf\u25cf\u25cf\u25cf\u25cf\u25cf\u25cf\u25cf\u25cf\u25cf\u25cf\u25cf","likes":{"count":0},"owner":{"id":"2258698218"},"thumbnail_src":"https:\/\/scontent-waw1-1.cdninstagram.com\/hphotos-xap1\/t51.2885-15\/e35\/c40.0.240.240\/12383310_152272825147098_2095126197_n.jpg","is_video":false,"id":"1163236061090041815","display_src":"https:\/\/scontent-waw1-1.cdninstagram.com\/hphotos-xap1\/t51.2885-15\/e35\/12383310_152272825147098_2095126197_n.jpg"},{"code":"BAkpQjNJx7g","date":1452888566.0,"dimensions":{"width":480,"height":480},"comments":{"count":0},"caption":"Anyone know how to gain weight fast?\n #selfie #nofilter @androidhashtags #instagramtags #webstagram #l4l #like4me #like4like #like4tags #likeforme #like4follow #likeforlike #like4follower #likeforfollow #like4followers #likeforliketeam #likeforfollowers #likeforlikealways #tags4like #tags4follow #tagsforlikes #tagsforfollow #followme #follow4follow #followforfollow #amazing #all_shots #alwaysfollowback #20likes #nice #tbt","likes":{"count":0},"owner":{"id":"268057502"},"thumbnail_src":"https:\/\/scontent-waw1-1.cdninstagram.com\/hphotos-xat1\/t51.2885-15\/e35\/1389092_169288020102242_1520887411_n.jpg","is_video":false,"id":"1163236060988645088","display_src":"https:\/\/scontent-waw1-1.cdninstagram.com\/hphotos-xat1\/t51.2885-15\/s480x480\/e35\/1389092_169288020102242_1520887411_n.jpg"},{"code":"BAkpQhgEIw2","date":1452888565.0,"dimensions":{"width":1080,"height":1080},"comments":{"count":0},"caption":"Me creo ruda \ud83d\udcaa\n#like #likeforlike #instalike #l4l #like4like #follow #followforfollow #f4f #instafollow #follow4follow #instagram #instanice #chilegram","likes":{"count":0},"owner":{"id":"614216058"},"thumbnail_src":"https:\/\/scontent-waw1-1.cdninstagram.com\/hphotos-xap1\/t51.2885-15\/s640x640\/sh0.08\/e35\/12568879_1555744258079612_1598420591_n.jpg","is_video":false,"id":"1163236059158449206","display_src":"https:\/\/scontent-waw1-1.cdninstagram.com\/hphotos-xap1\/t51.2885-15\/e35\/12568879_1555744258079612_1598420591_n.jpg"},{"code":"BAkpQhcNndF","date":1452888565.0,"dimensions":{"width":480,"height":480},"comments":{"count":0},"caption":"#instagood #love #my #kiss #kids #follow #like4like #likeforlike #like4like #followforfollow #best #cool #girl #nice #good #happy #holiday #niceday #happyfriday #mylove","likes":{"count":0},"owner":{"id":"1216013484"},"thumbnail_src":"https:\/\/scontent-waw1-1.cdninstagram.com\/hphotos-xpf1\/t51.2885-15\/e35\/12424493_1706769086221971_151569323_n.jpg","is_video":false,"id":"1163236059093825349","display_src":"https:\/\/scontent-waw1-1.cdninstagram.com\/hphotos-xpf1\/t51.2885-15\/s480x480\/e35\/12424493_1706769086221971_151569323_n.jpg"},{"code":"BAkpQgpLa7G","date":1452888565.0,"dimensions":{"width":480,"height":480},"comments":{"count":0},"caption":"#selfie #nofilter @androidhashtags #instagramtags #webstagram #l4l #like4me #like4like #like4tags #likeforme #like4follow #likeforlike #like4follower #likeforfollow #like4followers #likeforliketeam #likeforfollowers #likeforlikealways #tags4like #tags4follow #tagsforlikes #tagsforfollow #followme #follow4follow #followforfollow #amazing #all_shots #alwaysfollowback #20likes #nice #tbt","likes":{"count":0},"owner":{"id":"1537592922"},"thumbnail_src":"https:\/\/scontent-waw1-1.cdninstagram.com\/hphotos-xtf1\/t51.2885-15\/e35\/12545328_572401472928143_1981078684_n.jpg","is_video":false,"id":"1163236058237611718","display_src":"https:\/\/scontent-waw1-1.cdninstagram.com\/hphotos-xtf1\/t51.2885-15\/s480x480\/e35\/12545328_572401472928143_1981078684_n.jpg"},{"code":"BAkpQgbwwKy","date":1452888565.0,"dimensions":{"width":1080,"height":1080},"comments":{"count":0},"caption":"@Regrann from @natali3061 -  #TysFollowTrain #TyHelpMeGain \u00a0#GainWithTy #TysFollowTrain\u2122 #KFreeGainTrain #LikeForLike #LFL \u00a0#IFB #SFS #S4S #FollowTrain #GainPost #FollowBack #FollowParty #FollowTrick #2016FollowTrain #UglyFollowTrain #Jay2016GainTrain #UglyGainTrain #JayGainingTrain #2016CashFollowTrain \u00a0#FollowTrain2016 #NewYearsGainTrain  #CashGainingTrain #SpamForSpam \u00a0#Recent4Recent \u00a0#followforfollow #Regrann","likes":{"count":0},"owner":{"id":"2388794287"},"thumbnail_src":"https:\/\/scontent-waw1-1.cdninstagram.com\/hphotos-xpt1\/t51.2885-15\/s640x640\/sh0.08\/e35\/12383534_561219697375468_1353242741_n.jpg","is_video":false,"id":"1163236058012517042","display_src":"https:\/\/scontent-waw1-1.cdninstagram.com\/hphotos-xpt1\/t51.2885-15\/e35\/12383534_561219697375468_1353242741_n.jpg"},{"code":"BAkpQf9PlrM","date":1452888565.0,"dimensions":{"width":612,"height":612},"comments":{"count":0},"caption":"Me \u2733\u26c4\ud83d\ude04\r#instalike #instapic #instagood #vsco #amazing #f4f#follow #me #boy #smile #selfie #l4l #like #like4like #like4like #likeforlike #cool #snow #tree #trees #photographer","likes":{"count":0},"owner":{"id":"428083989"},"thumbnail_src":"https:\/\/scontent-waw1-1.cdninstagram.com\/hphotos-xpt1\/t51.2885-15\/e15\/12568200_1178948542134491_512053496_n.jpg","is_video":false,"id":"1163236057500506828","display_src":"https:\/\/scontent-waw1-1.cdninstagram.com\/hphotos-xpt1\/t51.2885-15\/e15\/12568200_1178948542134491_512053496_n.jpg"},{"code":"BAkpQfSmvhd","date":1452888565.0,"dimensions":{"width":480,"height":480},"comments":{"count":0},"caption":"Al centroooo\ud83d\ude4c #me #like4like #likeforlike #instamoment","likes":{"count":0},"owner":{"id":"1309101725"},"thumbnail_src":"https:\/\/scontent-waw1-1.cdninstagram.com\/hphotos-xfa1\/t51.2885-15\/e35\/12545357_553531814811453_1714186566_n.jpg","is_video":false,"id":"1163236056785156189","display_src":"https:\/\/scontent-waw1-1.cdninstagram.com\/hphotos-xfa1\/t51.2885-15\/e35\/12545357_553531814811453_1714186566_n.jpg"},{"code":"BAkpQdIGOCX","date":1452888565.0,"dimensions":{"width":1080,"height":1080},"comments":{"count":0},"caption":"Miror and ngeblur;;) #latepost #gabut #LikeForLike","likes":{"count":0},"owner":{"id":"2413116591"},"thumbnail_src":"https:\/\/scontent-waw1-1.cdninstagram.com\/hphotos-xpt1\/t51.2885-15\/s640x640\/sh0.08\/e35\/12555916_1035205366551953_1588378892_n.jpg","is_video":false,"id":"1163236054461374615","display_src":"https:\/\/scontent-waw1-1.cdninstagram.com\/hphotos-xpt1\/t51.2885-15\/e35\/12555916_1035205366551953_1588378892_n.jpg"},{"code":"BAkpQc9TU1p","date":1452888565.0,"dimensions":{"width":750,"height":750},"comments":{"count":0},"caption":"Ya somos #20k en esta galeria en donde mostramos desde lo mas conocido hasta lo menos explorado (en nuestro estado) no queda mas que decir Gracias! El Estado Falcon tiene muchas maravillas que mostrar! \ud83d\udc46 #MedanosDeCoro #Coro #edofalcon #venezuela \nFotograf\u00eda: @hichfotografo \nRecuerda #EsTuHogar \ud83c\udf43\n\n#sunrise #tagsforlikes #likeforlike #like4like #clouds #sky #nature #sunset #drone #gopro #Caribe #atardecer #video #nikon #canon #landscape #light #night #dunes #desert #beach  #20mil #photos","likes":{"count":1},"owner":{"id":"1489929946"},"thumbnail_src":"https:\/\/scontent-waw1-1.cdninstagram.com\/hphotos-xft1\/t51.2885-15\/s640x640\/sh0.08\/e35\/12523691_685609931579078_1688102937_n.jpg","is_video":false,"id":"1163236054280260969","display_src":"https:\/\/scontent-waw1-1.cdninstagram.com\/hphotos-xft1\/t51.2885-15\/s750x750\/sh0.08\/e35\/12523691_685609931579078_1688102937_n.jpg"},{"code":"BAkpQbdhYNJ","date":1452888565.0,"dimensions":{"width":640,"height":640},"comments":{"count":0},"caption":"#likeforlike\u00a0#like4like\u00a0#likeforfollow\u00a0#likesforlikes#followforfollow\u00a0#follow4follow\u00a0#tagsforlikes\u00a0#l4l#followme\u00a0#spamforspam\u00a0#f4f\u00a0#likeforlikealways#love\u00a0#likeforlikes\u00a0#spam4spam\u00a0#recentforrecent#recent4recent\u00a0#likeback\u00a0#followback\u00a0#follow#trocolikes\u00a0#likes4likes\u00a0#likes\u00a0#likeforfollow#like4likes\u00a0#instagood\u00a0#selfie\u00a0#r4r\u00a0#likeforlikeback#like4follow\u00a0#likeforlike\u00a0#like4like\u00a0#likeforfollow#likesforlikes\u00a0#followforfollow\u00a0#follow4follow#tagsforlikes\u00a0#l4l\u00a0#followme\u00a0#spamforspam\u00a0#f4f#likeforlikealways\u00a0#love\u00a0#likeforlikes\u00a0#spam4spam#recentforrecent\u00a0#recent4recent\u00a0#likeback#followback\u00a0#follow\u00a0#trocolikes\u00a0#likes4likes\u00a0#likes#likeforfollow\u00a0#like4likes\u00a0#instagood\u00a0#selfie\u00a0#r4r#likeforlikeback\u00a0#like4follow\u00a0#likeforlike\u00a0#like4like#likeforlike\u00a0#like4like\u00a0#likeforfollow\u00a0#likesforlikes#followforfollow\u00a0#follow4follow\u00a0#tagsforlikes\u00a0#l4l#followme\u00a0#spamforspam\u00a0#f4f\u00a0#likeforlikealways#love\u00a0#likeforlikes\u00a0#spam4spam\u00a0#recentforrecent#recent4recent\u00a0#likeback\u00a0#followback\u00a0#follow#trocolikes\u00a0#likes4likes\u00a0#likes\u00a0#likeforfollow#like4likes\u00a0#instagood\u00a0#selfie\u00a0#r4r\u00a0#likeforlikeback#like4follow\u00a0#likeforlike\u00a0#like4like\u00a0#likeforfollow#likesforlikes\u00a0#followforfollow\u00a0#follow4follow#tagsforlikes\u00a0#l4l\u00a0#followme\u00a0#spamforspam\u00a0#f4f#likeforlikealways\u00a0#love\u00a0#likeforlikes\u00a0#spam4spam#recentforrecent\u00a0#recent4recent\u00a0#likeback#followback\u00a0#follow\u00a0#trocolikes\u00a0#likes4likes\u00a0#likes#likeforfollow\u00a0#like4likes\u00a0#instagood\u00a0#selfie\u00a0#r4r#likeforlikeback\u00a0#like4follow\u00a0#likeforlike\u00a0#like4like","likes":{"count":1},"owner":{"id":"2593275351"},"thumbnail_src":"https:\/\/scontent-waw1-1.cdninstagram.com\/hphotos-xpf1\/t51.2885-15\/e35\/12424517_1668649456706380_352644376_n.jpg","is_video":false,"id":"1163236052673332041","display_src":"https:\/\/scontent-waw1-1.cdninstagram.com\/hphotos-xpf1\/t51.2885-15\/e35\/12424517_1668649456706380_352644376_n.jpg"},{"code":"BAkpQatAM-Q","date":1452888565.0,"dimensions":{"width":640,"height":640},"comments":{"count":0},"caption":"#amazing #men #likeforlike","likes":{"count":0},"owner":{"id":"2521250050"},"thumbnail_src":"https:\/\/scontent-waw1-1.cdninstagram.com\/hphotos-xtp1\/t51.2885-15\/s640x640\/sh0.08\/e35\/12568282_708058855997020_1947253039_n.jpg","is_video":false,"id":"1163236051859328912","display_src":"https:\/\/scontent-waw1-1.cdninstagram.com\/hphotos-xtp1\/t51.2885-15\/s640x640\/sh0.08\/e35\/12568282_708058855997020_1947253039_n.jpg"}]},"content_advisory":null,"top_posts":{"nodes":[{"code":"BAklqv8wH5S","date":1452886683.0,"dimensions":{"width":1080,"height":1316},"comments":{"count":49},"caption":"Have a good night\u263a\ufe0f\nPh: @artemclick \ud83d\udcf7","likes":{"count":2220},"owner":{"id":"244994126"},"thumbnail_src":"https:\/\/scontent-waw1-1.cdninstagram.com\/hphotos-xap1\/t51.2885-15\/s640x640\/sh0.08\/e35\/c0.118.1080.1080\/12424485_451780545015626_439994817_n.jpg","is_video":false,"id":"1163220269192478290","display_src":"https:\/\/scontent-waw1-1.cdninstagram.com\/hphotos-xap1\/t51.2885-15\/e35\/12424485_451780545015626_439994817_n.jpg"},{"code":"BAkm2N-Nyj2","date":1452887301.0,"dimensions":{"width":640,"height":640},"comments":{"count":7},"caption":"It was my birthday yesterday, I dont know about you but I feel like 22 \ud83d\ude09\ud83c\udf89 ______________\n\n#selfie #me #girl #followme #likeforlike #like4like #picoftheday #birthday #happy #birthdaygirl #22 #mood #model #friday #weekend #love #beautiful #life #instagood #bae #follow #photooftheday #amazing #igers #instalove #2016 #happybirthday #bday #celebrate #tbt","likes":{"count":1455},"owner":{"id":"2013348529"},"thumbnail_src":"https:\/\/scontent-waw1-1.cdninstagram.com\/hphotos-xfa1\/t51.2885-15\/e15\/12552334_216909291979499_1702965203_n.jpg","is_video":true,"id":"1163225455390042358","display_src":"https:\/\/scontent-waw1-1.cdninstagram.com\/hphotos-xfa1\/t51.2885-15\/e15\/12552334_216909291979499_1702965203_n.jpg"},{"code":"BAkks3dwI-v","date":1452886176.0,"dimensions":{"width":640,"height":640},"comments":{"count":7},"caption":"When #falcao scored this BEAST \ud83d\ude31\u26bd\ufe0f","likes":{"count":1189},"owner":{"id":"998589130"},"thumbnail_src":"https:\/\/scontent-waw1-1.cdninstagram.com\/hphotos-xtf1\/t51.2885-15\/e15\/10413843_1705486779664882_1380094612_n.jpg","is_video":true,"id":"1163216016654765999","display_src":"https:\/\/scontent-waw1-1.cdninstagram.com\/hphotos-xtf1\/t51.2885-15\/e15\/10413843_1705486779664882_1380094612_n.jpg"},{"code":"BAkfvLXSvcx","date":1452883574.0,"dimensions":{"width":750,"height":750},"comments":{"count":2},"caption":"De\u011fi\u015fim\ud83d\udc4d\ud83c\udffc\ud83d\udc4d\ud83c\udffc\ud83d\udc4d\ud83c\udffc\ud83d\udc4d\ud83c\udffc#instahair #naturallook #yayornay #ombre #sombre #k\u0131rma #pigmentasyon #newoldhair #beauty #harikasaclar#efsanesaclar #hairfashion #follow #followback #like #likeforlike #fashion #makeup #hair #amazing #swetie #cutie #turkey #jj #davines #brushlights #scalp #selective","likes":{"count":2408},"owner":{"id":"2090304796"},"thumbnail_src":"https:\/\/scontent-waw1-1.cdninstagram.com\/hphotos-xpf1\/t51.2885-15\/s640x640\/sh0.08\/e35\/10838309_1538041459848449_2090962865_n.jpg","is_video":false,"id":"1163194185227630385","display_src":"https:\/\/scontent-waw1-1.cdninstagram.com\/hphotos-xpf1\/t51.2885-15\/e35\/10838309_1538041459848449_2090962865_n.jpg"},{"code":"BAkmPt4MgSk","date":1452886986.0,"dimensions":{"width":1080,"height":1080},"comments":{"count":21},"caption":"Perfect Rotation || \ud83d\udcf7 by @kevstarrosso \n_____________________________________________\n\n#Adidas #Yeezy #350 #950 #nike #airforce #balenciaga #vans #kanyewest #yeezus #kanye #great #white #black #igers #igdaily #follow #followme #follow4follow #followforfollow #like4like #likeforlike #tag #tagsforlikes","likes":{"count":2481},"owner":{"id":"429408200"},"thumbnail_src":"https:\/\/scontent-waw1-1.cdninstagram.com\/hphotos-xtp1\/t51.2885-15\/s640x640\/sh0.08\/e35\/12568910_871524286280144_2019693772_n.jpg","is_video":false,"id":"1163222809589187748","display_src":"https:\/\/scontent-waw1-1.cdninstagram.com\/hphotos-xtp1\/t51.2885-15\/e35\/12568910_871524286280144_2019693772_n.jpg"},{"code":"BAkjxJBDru2","date":1452885687.0,"dimensions":{"width":480,"height":480},"comments":{"count":5},"caption":"''Brothers who work together, Stay Together''\ud83d\udc4a\n_______________________________________________#uglyfollowtrain #followme #cashfollowtrain #recentforrecent #likeforlike #Romanreigns #likeforfollow #f4f #selenagomez #arianagrande #justinbieber #gainpost #active #theundertaker #wwe #ufc #romanreigns #wwetlc #soccer #fifa #instagood #instamood #followme #followback #kimkardashian #r4r #spamforspam #royalrumble #instagood #deanambrose","likes":{"count":953},"owner":{"id":"1467415941"},"thumbnail_src":"https:\/\/scontent-waw1-1.cdninstagram.com\/hphotos-xaf1\/t51.2885-15\/e35\/12545516_450582301798283_691145898_n.jpg","is_video":false,"id":"1163211912332098486","display_src":"https:\/\/scontent-waw1-1.cdninstagram.com\/hphotos-xaf1\/t51.2885-15\/s480x480\/e35\/12545516_450582301798283_691145898_n.jpg"},{"code":"BAkkH_YjoH2","date":1452885874.0,"dimensions":{"width":640,"height":640},"comments":{"count":3},"caption":"#musically #musica #music #best #video #dontjudgeme #dubsmash #bu #vines #dance #me #hot #love #beautiful #girl #boy #lol #russia #crazy #instagram #instagrammers #instagood #followme #follow #like4like #likeforlike","likes":{"count":618},"owner":{"id":"1479090927"},"thumbnail_src":"https:\/\/scontent-waw1-1.cdninstagram.com\/hphotos-xaf1\/t51.2885-15\/e15\/918200_1694434770803308_939071078_n.jpg","is_video":true,"id":"1163213482536894966","display_src":"https:\/\/scontent-waw1-1.cdninstagram.com\/hphotos-xaf1\/t51.2885-15\/e15\/918200_1694434770803308_939071078_n.jpg"},{"code":"BAknMitAMQK","date":1452887484.0,"dimensions":{"width":640,"height":640},"comments":{"count":6},"caption":"Love these nails by @Yagala\n#motd #ghalichiglam #ilovemakeup #ilovemacgirls #makeup #makeupartist #vegas_nay #dressyourface #anastasiabeverlyhills #mua #likeforlike #like4like #tagsforlikes #instagay #instaglam #iphonesia #nailart #igers #igmua #hudabeauty #wakeupandmakeup #makeupmafia #mac #makeupoftheday #maccosmetics #fashion #instafit #beauty \u00a0#\u062a\u062c\u0645\u064a\u0644#\u0645\u0643\u064a\u0627\u062c","likes":{"count":388},"owner":{"id":"30330048"},"thumbnail_src":"https:\/\/scontent-waw1-1.cdninstagram.com\/hphotos-xpt1\/t51.2885-15\/e15\/12446011_996364100447240_1959968412_n.jpg","is_video":true,"id":"1163226989478331402","display_src":"https:\/\/scontent-waw1-1.cdninstagram.com\/hphotos-xpt1\/t51.2885-15\/e15\/12446011_996364100447240_1959968412_n.jpg"},{"code":"BAkkbaBmPPA","date":1452886033.0,"dimensions":{"width":640,"height":360},"comments":{"count":7},"caption":"Awon #bellovers ti takeover #shodem #Repost @_1stepofficial: Because @_1stepofficial are #Bellovers so we did this dance for @koredebello @koredebello PART 2 #Bellovers #SHODEM #TeamOneStep #LikeForLike #FollowForFollow #Afrobeat #BackToBack #dab #shumuderdance #Whip #naenae \n____________________\n#Romantic, the brand new music video from mega superstar @koredebello featuring #Mavins first lady @tiwasavage => bit.ly\/romanticvid ( link in @koredebello\u2019s bio )","likes":{"count":572},"owner":{"id":"1488086595"},"thumbnail_src":"https:\/\/scontent-waw1-1.cdninstagram.com\/hphotos-xfp1\/t51.2885-15\/e15\/c140.0.360.360\/12556049_1108594129152293_801879157_n.jpg","is_video":true,"id":"1163214816812790720","display_src":"https:\/\/scontent-waw1-1.cdninstagram.com\/hphotos-xfp1\/t51.2885-15\/e15\/12556049_1108594129152293_801879157_n.jpg"}]},"name":"likeforlike"},"__get_params":{}}]},"qe":{"su":{"p":{},"g":""}},"display_properties_server_guess":{"viewport_width":1366,"pixel_ratio":1.0},"config":{"viewer":{"username":"walleyholy","has_profile_pic":true,"profile_pic_url":"https:\/\/scontent-waw1-1.cdninstagram.com\/hphotos-xtp1\/t51.2885-19\/s150x150\/12353918_183655941988806_667325623_a.jpg","full_name":"holy walley","id":"1779603065","biography":"18 y.o. Minsk. Beauty as inspiration","external_url":"http:\/\/vk.com\/holywalley"},"csrf_token":"105fa5af0bbd570ff7d1005f98d2116d"},"environment_switcher_visible_server_guess":true};

Покопался с примером, понимаю, что вроде как в итоге должен получить список из словарей, к которым смог бы легко обращаться, буду копать дальше

Возможно разобрался, вот мой код(по пути решил проблему из-за которой создавал тему)
g.setup()
likeforlike = g.go('https://www.instagram.com/explore/tags/likeforlike/')
likeforlike = likeforlike.body.decode()
scriptX = likeforlike.index('<script type="text/javascript">window._sharedData')
scriptY = likeforlike.index('</script>',scriptX+1)
scriptJSON = likeforlike[scriptX+len('<script type="text/javascript">window._sharedData = '):scriptY-1]
print(scriptJSON)
s = json.loads(scriptJSON)

Не могу вывести этот текст из-за проблемы с кодировкой
UnicodeEncodeError: ‘charmap’ codec can't encode character ‘\U0001f451’ in position 1117: character maps to <undefined>

Во всём разобрался, всё получилось, спасибо огромное!)
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Powered by DjangoBB