mirror of
https://github.com/jlengrand/OpenGraphKt.git
synced 2026-03-10 08:31:23 +00:00
Using more concise naming
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
package fr.lengrand.opengraphkt
|
package fr.lengrand.opengraphktremote
|
||||||
|
|
||||||
|
import fr.lengrand.opengraphkt.OpenGraphParser
|
||||||
import org.jsoup.Jsoup
|
import org.jsoup.Jsoup
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -8,7 +8,7 @@ import java.net.URI
|
|||||||
* Example demonstrating how to use the OpenGraphParser to extract Open Graph data from HTML.
|
* Example demonstrating how to use the OpenGraphParser to extract Open Graph data from HTML.
|
||||||
*/
|
*/
|
||||||
fun main() {
|
fun main() {
|
||||||
val parser = OpenGraphParser()
|
val parser = Parser()
|
||||||
|
|
||||||
// Example 1: Parse Open Graph data from a URL
|
// Example 1: Parse Open Graph data from a URL
|
||||||
println("Example 1: Parsing from URL")
|
println("Example 1: Parsing from URL")
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ plugins {
|
|||||||
}
|
}
|
||||||
|
|
||||||
group = "fr.lengrand"
|
group = "fr.lengrand"
|
||||||
version = "0.0.1"
|
version = "0.0.2-SNAPSHOT"
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ import java.net.URL
|
|||||||
*
|
*
|
||||||
* @see <a href="https://ogp.me/">Open Graph Protocol</a>
|
* @see <a href="https://ogp.me/">Open Graph Protocol</a>
|
||||||
*/
|
*/
|
||||||
class OpenGraphParser {
|
class Parser {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Extracts all Open Graph tags from a JSoup Document and returns a structured Data object.
|
* Extracts all Open Graph tags from a JSoup Document and returns a structured Data object.
|
||||||
@@ -7,9 +7,9 @@ import kotlin.test.assertEquals
|
|||||||
import kotlin.test.assertNotNull
|
import kotlin.test.assertNotNull
|
||||||
import kotlin.test.assertTrue
|
import kotlin.test.assertTrue
|
||||||
|
|
||||||
class OpenGraphParserTest {
|
class ParserTest {
|
||||||
|
|
||||||
private val parser = OpenGraphParser()
|
private val parser = Parser()
|
||||||
|
|
||||||
// Sample HTML with all required OpenGraph tags and some structured properties
|
// Sample HTML with all required OpenGraph tags and some structured properties
|
||||||
private val completeHtml = """
|
private val completeHtml = """
|
||||||
Reference in New Issue
Block a user