Video tag does not seems to be parsed
Closed this issue ยท 10 comments
Video tag does not seems to be parsed. I will try to implement a base version of it with test
For sure, you can check any video on youtube, or any other website that might be display as video on twitter / FB etc.
https://www.youtube.com/watch?v=1MxA0i2rxQo
I plan to do simple implementation for it today :)
Thx AyWa!
1 thing to add, I'm planning to release v2 in few weeks, can you send your PR to develop
?
and any feedback on develop
will be welcomed ;)
Sure let me do that on develop
branch :)
Should we include 7d11cc9 to develop branch too ?
I already rebased develop
branch and Walk
is there ;)
Can you please just branch out from the latest develop
๐
So I am testing develop
branch, and it seems better than before ๐
Just wonder if this part:
https://github.com/otiai10/opengraph/blob/develop/opengraph.go#L127
can be inside the opengraph.New()
? because now I need to do something like:
og := opengraph.New(reqURL)
og.Intent.TrustedTags = []string{opengraph.HTMLMetaTag, opengraph.HTMLTitleTag, opengraph.HTMLLinkTag}
og.Walk(....
Thank you, good catch!
The only guy who needs to know what TrustedTags
are is walk
, therefore I'd prefer below:
func (og *OpenGraph) walk(node *html.Node) error {
if len(og.Intent.TrustedTags) == 0 {
if og.Intent.Strict {
og.Intent.TrustedTags = []string{HTMLMetaTag}
} else {
og.Intent.TrustedTags = []string{HTMLMetaTag, HTMLTitleTag, HTMLLinkTag}
}
}
// following stuff here
}
Let me know your opinion.
Wait, if it's like that, that code block will be executed for all walk
which are called recursively.
Then I'd like to suggest:
func (og *OpenGraph) Parse(body io.Reader) error {
// other stuff here
- og.walk(node)
+ og.Walk(node)
return nil
}
func (og *OpenGraph) Walk(n *html.Node) error {
+ if len(og.Intent.TrustedTags) == 0 {
+ if og.Intent.Strict {
+ og.Intent.TrustedTags = []string{HTMLMetaTag}
+ } else {
+ og.Intent.TrustedTags = []string{HTMLMetaTag, HTMLTitleTag, HTMLLinkTag}
+ }
+ }
return og.walk(n)
}
I think it is fine for me too ๐