diff --git a/CHANGELOG.md b/CHANGELOG.md index 9e0f792..f1319ad 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -25,15 +25,15 @@ ## [3.4.0](https://github.com/LeonardoCardoso/Swift-Link-Preview/releases/tag/3.4.0) #### Added -- Added support for m3u8 lists +- Added support for m3u8 lists [#138](https://github.com/LeonardoCardoso/SwiftLinkPreview/issues/138) - Added by [jeffhodsdon](https://github.com/jeffhodsdon) #### Changed -- Resolve relative image URLs against the request URL. +- Resolve relative image URLs against the request URL. [#136](https://github.com/LeonardoCardoso/SwiftLinkPreview/issues/136) - Changed by [lhunath](https://github.com/lhunath) -- Video parsing fix +- Video parsing fix [#138](https://github.com/LeonardoCardoso/SwiftLinkPreview/issues/138) - Changed by [jeffhodsdon](https://github.com/jeffhodsdon) -- Fixed github link image for `og:image` property. +- Fixed github link image for `og:image` property. [#145](https://github.com/LeonardoCardoso/SwiftLinkPreview/issues/145) - Changed by [MuhtasimTanmoy](https://github.com/MuhtasimTanmoy/) ## [3.3.0](https://github.com/LeonardoCardoso/Swift-Link-Preview/releases/tag/3.3.0) @@ -43,6 +43,8 @@ - Changed by [lhunath](https://github.com/lhunath) - fixed youtube and open graph tags image metadata issues - Changed by [nafis042](https://github.com/nafis042) +- Fixed github link image for `og:image` property. + - Changed by [MuhtasimTanmoy](https://github.com/MuhtasimTanmoy/) ## [3.2.0](https://github.com/LeonardoCardoso/Swift-Link-Preview/releases/tag/3.2.0) diff --git a/Example/SwiftLinkPreviewExample/Controllers/ViewController.swift b/Example/SwiftLinkPreviewExample/Controllers/ViewController.swift index 04408ee..3bb2d28 100644 --- a/Example/SwiftLinkPreviewExample/Controllers/ViewController.swift +++ b/Example/SwiftLinkPreviewExample/Controllers/ViewController.swift @@ -38,6 +38,8 @@ class ViewController: UIViewController { "www.youtube.com", "www.google.com", "facebook.com", + + "https://github.com/LeonardoCardoso/SwiftLinkPreview", "https://leocardz.com/swift-link-preview-5a9860c7756f", "NASA! 🖖🏽 https://www.nasa.gov/", @@ -57,7 +59,6 @@ class ViewController: UIViewController { "Youtube?! It does! https://www.youtube.com/watch?v=cv2mjAgFTaI", "Also Vimeo https://vimeo.com/67992157", - "Even with image itself https://lh6.googleusercontent.com/-aDALitrkRFw/UfQEmWPMQnI/AAAAAAAFOlQ/mDh1l4ej15k/w337-h697-no/db1969caa4ecb88ef727dbad05d5b5b3.jpg", "Well, it's a gif! https://goo.gl/jKCPgp" ] diff --git a/Sources/Regex.swift b/Sources/Regex.swift index 0944777..c4e08dc 100644 --- a/Sources/Regex.swift +++ b/Sources/Regex.swift @@ -9,9 +9,8 @@ import Foundation // MARK: - Regular expressions class Regex { - - static let imagePattern = "(.+?)\\.(gif|jpg|jpeg|png|bmp)\\?.*$" - static let videoPattern = "(.+?)\\.(mp4|mpeg|avi|mov|m3u8)\\?.*$" + + static let imagePattern = "(.+?)\\.(gif|jpg|jpeg|png|bmp)$" static let openGraphImagePattern = "(.+?)\\.(gif||jpg|jpeg|png|bmp)$" static let videoTagPattern = "]+src=\"([^\"]+)" static let secondaryVideoTagPattern = "og:video\"(.+?)content=\"([^\"](.+?))\"(.+?)[/]?>"