Awful / Awful.app

Something Awful Forums browser for iOS
https://forums.somethingawful.com/showthread.php?threadid=3837546&perpage=40&noseen=1
137 stars 45 forks source link

embed mp4 files from imgur and gyfcat also youtube videos (#861) #980

Closed geoFlux closed 4 years ago

nolanw commented 4 years ago

Hey @geoFlux, appreciate it!

Historically I've done these kinds of transformations on the Swift side, in https://github.com/Awful/Awful.app/blob/1c3aef7bd83eb0ca466222e916c050aba1efd8d4/App/Misc/HTMLRenderingHelpers.swift. It makes life a bit easier when we (re-)render posts outside of the initial page load, e.g. because the user wants to see an ignored post.

Any interest in porting this over to HTMLRenderingHelpers.swift? I'm happy to help. Especially since I took so long to reply to you in #861 and didn't point you towards there sooner.

geoFlux commented 4 years ago

I can give it a shot. I'm new to Swift but it looks pretty straightforward.

realModusOperandi commented 4 years ago

Is that JS from somewhere or did you write it yourself?

geoFlux commented 4 years ago

It's based off the javascript from the forums. But I pretty much completely rewrote it. You can find it here: https://forums.somethingawful.com/js/vb/forums.combined.js?1476414202. If you prettify that, and search for imgur

geoFlux commented 4 years ago

I moved everything but the gyfcat code into swift. The code for gyfcat has to make an api call, and I don't know of a good way to make the swift code async.

nolanw commented 4 years ago

Yep that's fair enough re: gfycat, that's the setup we do for tweets. Thanks so much!