URLEmbeddedView
URLEmbeddedView copied to clipboard
OG data not read properly on certain sites
https://theyeshiva.net returns bad data but works fine on ios iMessage app
also no image on https://washingtonpost.com but is ok on iMessage
here is the iMessage successful loads
also I used facebook open graph debugger and except for small image warning it parsed ok
https://developers.facebook.com/tools/debug/sharing/?q=theyeshiva.net
this link.... I cant to read meta-data https://m.youtube.com/watch?v=kSUJ28rgNyo
@felixdkatt Sites you provided doesn't support OpenGraph protocol as it is. Facebook debug tool is not about OpenGraph protocol only. Facebook and iMessages do additional work on some common scenarios for sites that doesn't support OpenGraph. To check site against OpenGrpah protocol check this one: https://opengraphcheck.com/result.php?url=https%3A%2F%2Fwashingtonpost.com#.XIdnVRMzZTY https://opengraphcheck.com/result.php?url=https%3A%2F%2Ftheyeshiva.net#.XIdnZRMzZTY
OK, i think i have fix for that.
There are websites that are using "name" instead of "property" key in <meta ... block>
Also, sometimes websites are using capital P i < meta Property > and here regular expression is caseSensitive.
So here are my adjustments @marty-suzuki @felixdkatt
In OpenGraph.HTML.swift
change implementation of property regex like so:
static let regex: NSRegularExpression? = { let patterns = [ // "" & "" "(?:content\\s*=\\s*\"([^>]*)\"\\s*property\\s*=\\s*\"([^>]*)\")", "(?:property\\s*=\\s*\"([^>]*)\"\\s*content\\s*=\\s*\"([^>]*)\")", // name instead of property "(?:content\\s*=\\s*\"([^>]*)\"\\s*name\\s*=\\s*\"([^>]*)\")", "(?:name\\s*=\\s*\"([^>]*)\"\\s*content\\s*=\\s*\"([^>]*)\")", // '' & '' "(?:content\\s*=\\s*'([^>]*)'\\s*property\\s*=\\s*'([^>]*)')", "(?:property\\s*=\\s*'([^>]*)'\\s*content\\s*=\\s*'([^>]*)')", // "" & '' "(?:content\\s*=\\s*\"([^>]*)\"\\s*property\\s*=\\s*'([^>]*)')", "(?:property\\s*=\\s*\"([^>]*)\"\\s*content\\s*=\\s*'([^>]*)')", // '' & "" "(?:content\\s*=\\s*'([^>]*)'\\s*property\\s*=\\s*\"([^>]*)\")", "(?:property\\s*=\\s*'([^>]*)'\\s*content\\s*=\\s*\"([^>]*)\")" ] let pattern = "meta\\s*\(patterns.joined(separator: "|"))\\s*>?" return try? NSRegularExpression(pattern: pattern, options: [.caseInsensitive]) }()
here is pull request to fix that #84 @marty-suzuki
thank you @H3ndrx I will check it out