TheM4hd1 / SwiftyInsta

Instagram Private API Swift
MIT License
225 stars 56 forks source link

Stroy Url #20

Closed arda0011 closed 5 years ago

arda0011 commented 5 years ago

I can get my stories with getUserStory.

How can I get story url to show in my app?

TheM4hd1 commented 5 years ago

getUserStory returns stories of a specific username. if you want to receive your story feed, use getStoryFeed function. https://github.com/TheM4hd1/SwiftyInsta/blob/28b544577cf4dbb22048f4bfa397364664ac6b72/SwiftyInstaTests/SwiftyInstaTests.swift#L1201

arda0011 commented 5 years ago

getUserStory returns story feed and I do not want it. I want to play my own story not others stories. I need my own storied url to play it.

TheM4hd1 commented 5 years ago

I'm testing it right now and it works fine. Here is the results for getUserStory function:

 {"id": 8766457680, "latest_reel_media": 1557489370, "expiring_at": 1557575770, "seen": 0, "can_reply": false, "can_reshare": true, "reel_type": "user_reel", "user": {"pk": 8766457680, "username": "swiftyinsta", "full_name": "SwiftyInstaa", "is_private": false, "profile_pic_url": "https://scontent-lga3-1.cdninstagram.com/vp/6758bf089233a30cadc2aff0a25bfd8d/5D5A4221/t51.2885-19/s150x150/56340210_2574103572604215_333746158927085568_n.jpg?_nc_ht=scontent-lga3-1.cdninstagram.com", "profile_pic_id": "2027975031124337637_8766457680", "friendship_status": {"following": false, "followed_by": false, "blocking": false, "muting": false, "is_private": false, "incoming_request": false, "outgoing_request": false, "is_bestie": false, "is_restricted": false}, "is_verified": false}, "items": [{"taken_at": 1557489370, "pk": 2040691216362154311, "id": "2040691216362154311_8766457680", "device_timestamp": 1557489370315272, "media_type": 1, "code": "BxR_dlnhqlH", "client_cache_key": "MjA0MDY5MTIxNjM2MjE1NDMxMQ==.2", "filter_type": 0, "image_versions2": {"candidates": [{"width": 750, "height": 1334, "url": "https://scontent-lga3-1.cdninstagram.com/vp/28ccb26d99ed96f19f3de2a2addcf514/5CD7E7E8/t51.12442-15/e35/58749556_121169562413818_2965223290140168921_n.jpg?_nc_ht=scontent-lga3-1.cdninstagram.com\u0026ig_cache_key=MjA0MDY5MTIxNjM2MjE1NDMxMQ%3D%3D.2"}, {"width": 640, "height": 1138, "url": "https://scontent-lga3-1.cdninstagram.com/vp/b75ba991d7be5994f047db1e647c954e/5CD8AACF/t51.12442-15/sh0.08/e35/p640x640/58749556_121169562413818_2965223290140168921_n.jpg?_nc_ht=scontent-lga3-1.cdninstagram.com\u0026ig_cache_key=MjA0MDY5MTIxNjM2MjE1NDMxMQ%3D%3D.2"}, {"width": 480, "height": 853, "url": "https://scontent-lga3-1.cdninstagram.com/vp/67809449c753d71b5c1bc6fabd98aeda/5CD7BA10/t51.12442-15/e35/p480x480/58749556_121169562413818_2965223290140168921_n.jpg?_nc_ht=scontent-lga3-1.cdninstagram.com\u0026ig_cache_key=MjA0MDY5MTIxNjM2MjE1NDMxMQ%3D%3D.2"}, {"width": 320, "height": 569, "url": "https://scontent-lga3-1.cdninstagram.com/vp/641be76d2e064e3c78815417e40ab5aa/5CD8138A/t51.12442-15/e35/p320x320/58749556_121169562413818_2965223290140168921_n.jpg?_nc_ht=scontent-lga3-1.cdninstagram.com\u0026ig_cache_key=MjA0MDY5MTIxNjM2MjE1NDMxMQ%3D%3D.2"}, {"width": 240, "height": 426, "url": "https://scontent-lga3-1.cdninstagram.com/vp/93507e615c9294ecc5a40e919d391c55/5CD7E170/t51.12442-15/e35/p240x240/58749556_121169562413818_2965223290140168921_n.jpg?_nc_ht=scontent-lga3-1.cdninstagram.com\u0026ig_cache_key=MjA0MDY5MTIxNjM2MjE1NDMxMQ%3D%3D.2"}, {"width": 150, "height": 266, "url": "https://scontent-lga3-1.cdninstagram.com/vp/073a18a2f3234ec58c615a807ee18fd7/5CD786BA/t51.12442-15/e35/p150x150/58749556_121169562413818_2965223290140168921_n.jpg?_nc_ht=scontent-lga3-1.cdninstagram.com\u0026ig_cache_key=MjA0MDY5MTIxNjM2MjE1NDMxMQ%3D%3D.2"}, {"width": 750, "height": 750, "url": "https://scontent-lga3-1.cdninstagram.com/vp/f32061bda79866fd40eb335d454018f0/5CD7DE3C/t51.12442-15/e35/c0.292.750.750/58749556_121169562413818_2965223290140168921_n.jpg?_nc_ht=scontent-lga3-1.cdninstagram.com\u0026ig_cache_key=MjA0MDY5MTIxNjM2MjE1NDMxMQ%3D%3D.2.c"}, {"width": 640, "height": 640, "url": "https://scontent-lga3-1.cdninstagram.com/vp/f7c971f87cb4a028234087e5ae417591/5CD798B9/t51.12442-15/sh0.08/e35/c0.292.750.750/s640x640/58749556_121169562413818_2965223290140168921_n.jpg?_nc_ht=scontent-lga3-1.cdninstagram.com\u0026ig_cache_key=MjA0MDY5MTIxNjM2MjE1NDMxMQ%3D%3D.2.c"}, {"width": 480, "height": 480, "url": "https://scontent-lga3-1.cdninstagram.com/vp/d8c5df7414bc2943611b44a86c3e9a2c/5CD789BC/t51.12442-15/e35/c0.292.750.750/s480x480/58749556_121169562413818_2965223290140168921_n.jpg?_nc_ht=scontent-lga3-1.cdninstagram.com\u0026ig_cache_key=MjA0MDY5MTIxNjM2MjE1NDMxMQ%3D%3D.2.c"}, {"width": 320, "height": 320, "url": "https://scontent-lga3-1.cdninstagram.com/vp/284963028566c5f842166eb03d64395c/5CD8A226/t51.12442-15/e35/c0.292.750.750/s320x320/58749556_121169562413818_2965223290140168921_n.jpg?_nc_ht=scontent-lga3-1.cdninstagram.com\u0026ig_cache_key=MjA0MDY5MTIxNjM2MjE1NDMxMQ%3D%3D.2.c"}, {"width": 240, "height": 240, "url": "https://scontent-lga3-1.cdninstagram.com/vp/81b294bf471c8aa22531074188bab70d/5CD7E4DC/t51.12442-15/e35/c0.292.750.750/s240x240/58749556_121169562413818_2965223290140168921_n.jpg?_nc_ht=scontent-lga3-1.cdninstagram.com\u0026ig_cache_key=MjA0MDY5MTIxNjM2MjE1NDMxMQ%3D%3D.2.c"}, {"width": 150, "height": 150, "url": "https://scontent-lga3-1.cdninstagram.com/vp/c245245e7ce888f19df4485a9bfaca61/5CD7C816/t51.12442-15/e35/c0.292.750.750/s150x150/58749556_121169562413818_2965223290140168921_n.jpg?_nc_ht=scontent-lga3-1.cdninstagram.com\u0026ig_cache_key=MjA0MDY5MTIxNjM2MjE1NDMxMQ%3D%3D.2.c"}]}, "original_width": 750, "original_height": 1334, "caption_position": 0.0, "is_reel_media": true, "timezone_offset": 16200, "user": {"pk": 8766457680, "username": "swiftyinsta", "full_name": "SwiftyInstaa", "is_private": false, "profile_pic_url": "https://scontent-lga3-1.cdninstagram.com/vp/6758bf089233a30cadc2aff0a25bfd8d/5D5A4221/t51.2885-19/s150x150/56340210_2574103572604215_333746158927085568_n.jpg?_nc_ht=scontent-lga3-1.cdninstagram.com", "profile_pic_id": "2027975031124337637_8766457680", "is_verified": false, "has_anonymous_profile_picture": false, "can_boost_post": false, "can_see_organic_insights": false, "show_insights_terms": false, "reel_auto_archive": "on", "is_unpublished": false, "allowed_commenter_type": "any"}, "caption_is_edited": false, "photo_of_you": false, "caption": null, "fb_user_tags": {"in": []}, "can_viewer_save": true, "organic_tracking_token": "eyJ2ZXJzaW9uIjo1LCJwYXlsb2FkIjp7ImlzX2FuYWx5dGljc190cmFja2VkIjpmYWxzZSwidXVpZCI6IjgyY2M5Y2UyZThjZDQwOTFiMTA5YmE4NGI4NGU1ZGJmMjA0MDY5MTIxNjM2MjE1NDMxMSIsInNlcnZlcl90b2tlbiI6IjE1NTc0OTc1Mjk5MjR8MjA0MDY5MTIxNjM2MjE1NDMxMXw4NzY2NDU3NjgwfGE5NDQyYTM5ZjA5NjM2MjBmZWI4NzIwNzUxMjU1MTA5YzczOTcxMTYzNGFlM2Y5YWE3OGExNjk5M2JiN2MzZWUifSwic2lnbmF0dXJlIjoiIn0=", "expiring_at": 1557575770, "can_reshare": true, "can_reply": false, "creative_config": {"capture_type": "rich-text", "camera_facing": "front", "should_render_try_it_on": false}, "story_is_saved_to_archive": true, "viewers": [{"pk": 244420370, "username": "tolgakaramese", "full_name": "", "is_private": true, "profile_pic_url": "https://scontent-lga3-1.cdninstagram.com/vp/908c8eff4482847b6399eec7ee89222d/5D70C60C/t51.2885-19/s150x150/56618681_2377043405863269_1621025566381572096_n.jpg?_nc_ht=scontent-lga3-1.cdninstagram.com", "profile_pic_id": "2025008750548873287_244420370", "is_verified": false}], "viewer_count": 1, "viewer_cursor": null, "total_viewer_count": 1, "multi_author_reel_names": [], "supports_reel_reactions": true, "show_one_tap_fb_share_tooltip": true, "has_shared_to_fb": 0}], "prefetch_count": 0, "has_besties_media": false, "media_count": 1, "hide_from_feed_unit": true, "status": "ok"} 

as you see there is only one story in item array. it doesn't return story feed. Attach your code here, or send your username to test.

arda0011 commented 5 years ago

Yes it is working great but how can I play this story? How can I find story url?

TheM4hd1 commented 5 years ago

Check the test function: https://github.com/TheM4hd1/SwiftyInsta/blob/7be1a2e92507ded1aa1ce5375fb9963a2d51b261/SwiftyInstaTests/SwiftyInstaTests.swift#L1242

you should check for the media_type first, after that if it was image you can access image url from imageVersions2 property or videoVersions for video.

make sure to use latest version ofSwiftyInsta

arda0011 commented 5 years ago

VideoVersions always return nil. (I am using the latest version of SwiftyInsta)

TheM4hd1 commented 5 years ago

send your username, and if it's private accept request from SwiftyInsta account.

arda0011 commented 5 years ago

you can try with windmill01. I already added you on instagram.

TheM4hd1 commented 5 years ago

it's working. Result of your stories

[SwiftyInsta.VideoVersionModel(height: Optional(852), url: Optional("https://instagram.fevn1-1.fna.fbcdn.net/vp/516aa3324033770ad96526058f684b9c/5CDA39C3/t50.12441-16/60112587_200276997602346_2921962722359903193_n.mp4?efg=eyJ2ZW5jb2RlX3RhZyI6InZ0c192b2RfdXJsZ2VuLjQ4MC5zdG9yeSJ9&_nc_ht=instagram.fevn1-1.fna.fbcdn.net&vtsbc=1"), width: Optional(480), id: Optional("17878878790355537"), type: Optional(101)), SwiftyInsta.VideoVersionModel(height: Optional(852), url: Optional("https://instagram.fevn1-1.fna.fbcdn.net/vp/516aa3324033770ad96526058f684b9c/5CDA39C3/t50.12441-16/60112587_200276997602346_2921962722359903193_n.mp4?efg=eyJ2ZW5jb2RlX3RhZyI6InZ0c192b2RfdXJsZ2VuLjQ4MC5zdG9yeSJ9&_nc_ht=instagram.fevn1-1.fna.fbcdn.net&vtsbc=1"), width: Optional(480), id: Optional("17878878790355537"), type: Optional(102)), SwiftyInsta.VideoVersionModel(height: Optional(852), url: Optional("https://instagram.fevn1-1.fna.fbcdn.net/vp/516aa3324033770ad96526058f684b9c/5CDA39C3/t50.12441-16/60112587_200276997602346_2921962722359903193_n.mp4?efg=eyJ2ZW5jb2RlX3RhZyI6InZ0c192b2RfdXJsZ2VuLjQ4MC5zdG9yeSJ9&_nc_ht=instagram.fevn1-1.fna.fbcdn.net&vtsbc=1"), width: Optional(480), id: Optional("17878878790355537"), type: Optional(103))]
[SwiftyInsta.ProfilePicVersionsModel(height: Optional(1821), url: Optional("https://instagram.fevn1-1.fna.fbcdn.net/vp/774dbf43add081fd63f59967832ac4e3/5CDA0663/t51.12442-15/e35/59586262_295690198052104_8635670477232569629_n.jpg?_nc_ht=instagram.fevn1-1.fna.fbcdn.net&se=7&ig_cache_key=MjA0MTU2NzUxNTk3MjU4OTE5Nw%3D%3D.2"), width: Optional(1024)), SwiftyInsta.ProfilePicVersionsModel(height: Optional(1333), url: Optional("https://instagram.fevn1-1.fna.fbcdn.net/vp/972c71b5619edd332930f001d4e4eadf/5CDA9104/t51.12442-15/sh0.08/e35/p750x750/59586262_295690198052104_8635670477232569629_n.jpg?_nc_ht=instagram.fevn1-1.fna.fbcdn.net&ig_cache_key=MjA0MTU2NzUxNTk3MjU4OTE5Nw%3D%3D.2"), width: Optional(750)), SwiftyInsta.ProfilePicVersionsModel(height: Optional(1138), url: Optional("https://instagram.fevn1-1.fna.fbcdn.net/vp/a0b6e10fe0c2b0800f2f059d21c2ca59/5CDA8D04/t51.12442-15/sh0.08/e35/p640x640/59586262_295690198052104_8635670477232569629_n.jpg?_nc_ht=instagram.fevn1-1.fna.fbcdn.net&ig_cache_key=MjA0MTU2NzUxNTk3MjU4OTE5Nw%3D%3D.2"), width: Optional(640)), SwiftyInsta.ProfilePicVersionsModel(height: Optional(853), url: Optional("https://instagram.fevn1-1.fna.fbcdn.net/vp/3cd5e0758c0de416c961c59d62c109bc/5CDA901B/t51.12442-15/e35/p480x480/59586262_295690198052104_8635670477232569629_n.jpg?_nc_ht=instagram.fevn1-1.fna.fbcdn.net&ig_cache_key=MjA0MTU2NzUxNTk3MjU4OTE5Nw%3D%3D.2"), width: Optional(480)), SwiftyInsta.ProfilePicVersionsModel(height: Optional(569), url: Optional("https://instagram.fevn1-1.fna.fbcdn.net/vp/53b39eb5eb1b68c9822ae0842f13521e/5CDA1F41/t51.12442-15/e35/p320x320/59586262_295690198052104_8635670477232569629_n.jpg?_nc_ht=instagram.fevn1-1.fna.fbcdn.net&ig_cache_key=MjA0MTU2NzUxNTk3MjU4OTE5Nw%3D%3D.2"), width: Optional(320)), SwiftyInsta.ProfilePicVersionsModel(height: Optional(426), url: Optional("https://instagram.fevn1-1.fna.fbcdn.net/vp/42198715ec09400836c3bbef46da9de2/5CDA12BB/t51.12442-15/e35/p240x240/59586262_295690198052104_8635670477232569629_n.jpg?_nc_ht=instagram.fevn1-1.fna.fbcdn.net&ig_cache_key=MjA0MTU2NzUxNTk3MjU4OTE5Nw%3D%3D.2"), width: Optional(240)), SwiftyInsta.ProfilePicVersionsModel(height: Optional(266), url: Optional("https://instagram.fevn1-1.fna.fbcdn.net/vp/ade81b6209e5971989064728914f4811/5CDA7FB1/t51.12442-15/e35/p150x150/59586262_295690198052104_8635670477232569629_n.jpg?_nc_ht=instagram.fevn1-1.fna.fbcdn.net&ig_cache_key=MjA0MTU2NzUxNTk3MjU4OTE5Nw%3D%3D.2"), width: Optional(150)), SwiftyInsta.ProfilePicVersionsModel(height: Optional(750), url: Optional("https://instagram.fevn1-1.fna.fbcdn.net/vp/0bc01ddcd10325d9afbae9bec2ff31e2/5CDA2485/t51.12442-15/sh0.08/e35/c0.398.1024.1024/s750x750/59586262_295690198052104_8635670477232569629_n.jpg?_nc_ht=instagram.fevn1-1.fna.fbcdn.net&ig_cache_key=MjA0MTU2NzUxNTk3MjU4OTE5Nw%3D%3D.2.c"), width: Optional(750)), SwiftyInsta.ProfilePicVersionsModel(height: Optional(640), url: Optional("https://instagram.fevn1-1.fna.fbcdn.net/vp/4d9b24476db8c3292d4fde12f04fcc82/5CDA11C5/t51.12442-15/sh0.08/e35/c0.398.1024.1024/s640x640/59586262_295690198052104_8635670477232569629_n.jpg?_nc_ht=instagram.fevn1-1.fna.fbcdn.net&ig_cache_key=MjA0MTU2NzUxNTk3MjU4OTE5Nw%3D%3D.2.c"), width: Optional(640)), SwiftyInsta.ProfilePicVersionsModel(height: Optional(480), url: Optional("https://instagram.fevn1-1.fna.fbcdn.net/vp/844e495674b52563b6f4825debf484cf/5CDA2044/t51.12442-15/e35/c0.398.1024.1024/s480x480/59586262_295690198052104_8635670477232569629_n.jpg?_nc_ht=instagram.fevn1-1.fna.fbcdn.net&ig_cache_key=MjA0MTU2NzUxNTk3MjU4OTE5Nw%3D%3D.2.c"), width: Optional(480)), SwiftyInsta.ProfilePicVersionsModel(height: Optional(320), url: Optional("https://instagram.fevn1-1.fna.fbcdn.net/vp/bcc8ea6f171f6d0a2742e2052214435a/5CDAAA5E/t51.12442-15/e35/c0.398.1024.1024/s320x320/59586262_295690198052104_8635670477232569629_n.jpg?_nc_ht=instagram.fevn1-1.fna.fbcdn.net&ig_cache_key=MjA0MTU2NzUxNTk3MjU4OTE5Nw%3D%3D.2.c"), width: Optional(320)), SwiftyInsta.ProfilePicVersionsModel(height: Optional(240), url: Optional("https://instagram.fevn1-1.fna.fbcdn.net/vp/3f95c19c5e5a7bdbc74c17cb42e746db/5CDA5064/t51.12442-15/e35/c0.398.1024.1024/s240x240/59586262_295690198052104_8635670477232569629_n.jpg?_nc_ht=instagram.fevn1-1.fna.fbcdn.net&ig_cache_key=MjA0MTU2NzUxNTk3MjU4OTE5Nw%3D%3D.2.c"), width: Optional(240)), SwiftyInsta.ProfilePicVersionsModel(height: Optional(150), url: Optional("https://instagram.fevn1-1.fna.fbcdn.net/vp/a6e5b18b9af531cbf5077f9c20ef78cc/5CDA4D2E/t51.12442-15/e35/c0.398.1024.1024/s150x150/59586262_295690198052104_8635670477232569629_n.jpg?_nc_ht=instagram.fevn1-1.fna.fbcdn.net&ig_cache_key=MjA0MTU2NzUxNTk3MjU4OTE5Nw%3D%3D.2.c"), width: Optional(150))]

the latest version is 0.0.9

arda0011 commented 5 years ago

Thanks for your all help.