scinfu / swiftsoup Goto Github PK
View Code? Open in Web Editor NEWSwiftSoup: Pure Swift HTML Parser, with best of DOM, CSS, and jquery (Supports Linux, iOS, Mac, tvOS, watchOS)
Home Page: https://scinfu.github.io/SwiftSoup/
License: MIT License
SwiftSoup: Pure Swift HTML Parser, with best of DOM, CSS, and jquery (Supports Linux, iOS, Mac, tvOS, watchOS)
Home Page: https://scinfu.github.io/SwiftSoup/
License: MIT License
Hello! Your framework is popular enough to start logging all changes! This is my favourite Change Log as example. Thanks in advance!
Thai language is not displaying properly in UIWebview. We are running the html string through SwiftSoup, and the resulting string is manipulating the Thai characters. Here is the test example I've created:
"<br>\r\n<br>\r\n<font size=\"2\" face=\"sans-serif\">Lorem Ipsum บังคับ Amet นั่ง, consectetur adipiscing Elit Maecenas หุบเขาญี่ปุ่นเพียงอย่างเดียว ตอนนี้เวลาที่จะลงทุนโปรตีน เสียงนุ่มของสมาชิกในการไว้ทุกข์ VespaCam หุบเขากล่อง การเชื่อมโยงเว็บไซต์ Semper ใน ประสิทธิภาพการทำงานของเส้นผ่าศูนย์กลางใด ๆ แต่การดูแลผู้เล่นฟุตบอลสำนักฟุตบอลสมาร์ทและเรียงลำดับความต้องการ สดนำไปหักลดหย่อนเส้นผ่าศูนย์กลาง ID Ut Libero แต่ละช่วงเวลา lorem ถั่วลิสงได้บังคับ แต่ dui ราคา malesuada แต่ละเครือข่ายแครอทวันหยุดสุดสัปดาห์ ไม่มีน้ำซุปหรือซอส ullamcorper ullamcorper กลัวใครใหญ่กว่าลูกศรสารต้านอนุมูลอิสระ</font>"
We then take this string and run it through SwiftSoup.parse using this code:
let originalDocument = try SwiftSoup.parse(testString.replacingOccurrences(of: "\r\n", with: "\n"))
This is the result output:
Document <html><head></head><body><br> <br> <font size="2" face="sans-serif">Lorem Ipsum บงคบ Amet นง, consectetur adipiscing Elit Maecenas หบเขาญปนเพยงอยางเดยว ตอนนเวลาทจะลงทนโปรตน เสยงนมของสมาชกในการไวทกข VespaCam หบเขากลอง การเชอมโยงเวบไซต Semper ใน ประสทธภาพการทงานของเสนผาศนยกลางใด ๆ แตการดแลผเลนฟตบอลสนกฟตบอลสมารทและเรยงลดบความตองการ สดนไปหกลดหยอนเสนผาศนยกลาง ID Ut Libero แตละชวงเวลา lorem ถวลสงไดบงคบ แต dui ราคา malesuada แตละเครอขายแครอทวนหยดสดสปดาห ไมมนซปหรอซอส ullamcorper ullamcorper กลวใครใหญกวาลกศรสารตานอนมลอสระ</font></body>
</html>
How to implement this Jsoup code in Swiftsoup?
String URL = "http://www.example.com";
String USER_AGENT = "mozilla";
Response res;
Document doc;
res=Jsoup.connect(URL).userAgent(USER_AGENT)
.timeout(15000)
.data("id_bab", id_bab)
.method(Method.POST)
.followRedirects(true)
.ignoreContentType(true)
.execute();
if(res.statusCode() == 200){
doc = res.parse();
}
I am seeing this error anywhere this method is used throughout swiftsoup.
just for sake of being thourough this error began after installing tesseract and running the pod update function.
I removed tesseract and reinstalled and the error was still occuring
I opened a new project
ran pod init
added swifsoup and set package to version 10.3
ran pod install
opened new workspace
attempted to build blank project with just swift soup and am still recieving the same errors
I have completely reinstalled cocoapods, I have cleared my caches, I have attempted to clean the cache however non of this has helped.
if this is user error I am sorry
public static func parseBodyFragment(_ bodyHtml: String, _ baseUri: String)throws->Document {
let doc: Document = Document.createShell(baseUri)
if let body: Element = doc.body() {
let nodeList: Array<Node> = try parseFragment(bodyHtml, body, baseUri)
//var nodes: [Node] = nodeList.toArray(Node[nodeList.size()]) // the node list gets modified when re-parented
if nodeList.count > 0 {
for i in 1..<nodeList.count{
try nodeList[i].remove()
}
for node: Node in nodeList {
try body.appendChild(node)
}
}
}
return doc
}
I have added nodeList.count for that.
Works fine on macOS with 3.2, but naturally fails on Linux 😞
The log is here but looks like an issue with Matcher
. I'll try and dig into it when I get a chance
SwiftSoup seems to have some leaked objects (Attributes, Document, Tag etc.), when I use it.
Is this due to the library or my implementation?
When trying to use the following sample code:
do{
let html = "<title>First parse</title>"
+ "
Parsed HTML into a doc.
"Xcode returns the following error on the return try line:
Unexpected non-void return value in void function
When building an extension that uses SwiftSoup I get a linker warning:
ld: warning: linking against a dylib which is not safe for use in application extensions: /Users/.../Carthage/Build/iOS/SwiftSoup.framework/SwiftSoup
/Users/alex/Library/Developer/Xcode/DerivedData/Forecast-fwijjcxzzzlsqafojqsrnnuecwpm/Build/Products/Debug-iphoneos/Forecast.app/Frameworks/SwiftSoup.framework: unknown error -1=ffffffffffffffff
Command /bin/sh failed with exit code 1
Running on Iphone 5(IOS 10.0)
All other devices on IOS 11+ works correctly
I'm working on a legacy project that mixes Obj-C and Swift code, and want to replace string matching with SwiftSoup.
I'm pulling in SwiftSoup as a dependency with CocoaPods, and can use it from Swift without issue. Is there a way I can use SwiftSoup in the Obj-C code as well?
seems this function is not clean up, because it's do nothing there but open to call
This makes things a bit confusing.
Hi there,
I can't import SwiftSoup into my Xcode 9 project.
When typing in "import SwiftSoup" I get the following error: "No such module 'SwiftSoup' and 34 other compiler errors...
Is it planned to update SwiftSoup for Xcode 9? Any time plan when its ready?
How can I get all text nodes in a document, process/change the text and get the resulting document?
Lib version: 1.4.2
Swift 3
iPhone 7 - iOS 10.3
We have the following HTML where after parsing add an extra leading blank space.
HTML:
<html><body><div>\r\n<div dir=\"ltr\">\r\n<div id=\"divtagdefaultwrapper\"><font face=\"Calibri,Helvetica,sans-serif\" size=\"3\" color=\"black\"><span style=\"font-size:12pt;\" id=\"divtagdefaultwrapper\">\r\n<div style=\"margin-top:0;margin-bottom:0;\"> TEST</div>\r\n<div style=\"margin-top:0;margin-bottom:0;\">TEST</div>\r\n<div style=\"margin-top:0;margin-bottom:0;\">TEST</div>\r\n<div style=\"margin-top:0;margin-bottom:0;\"><br>\r\n\r\n</div>\r\n<div style=\"margin-top:0;margin-bottom:0;\">TEST</div>\r\n<div style=\"margin-top:0;margin-bottom:0;\">TEST</div>\r\n<div style=\"margin-top:0;margin-bottom:0;\">TEST</div>\r\n<div style=\"margin-top:0;margin-bottom:0;\"><br>\r\n\r\n</div>\r\n<div style=\"margin-top:0;margin-bottom:0;\"><br>\r\n\r\n</div>\r\n<div style=\"margin-top:0;margin-bottom:0;\">TEST</div>\r\n<div style=\"margin-top:0;margin-bottom:0;\">TEST</div>\r\n<div style=\"margin-top:0;margin-bottom:0;\">TEST</div>\r\n<div style=\"margin-top:0;margin-bottom:0;\"><br>\r\n\r\n</div>\r\n<div style=\"margin-top:0;margin-bottom:0;\"><br>\r\n\r\n</div>\r\n<div style=\"margin-top:0;margin-bottom:0;\"><br>\r\n\r\n</div>\r\n<div style=\"margin-top:0;margin-bottom:0;\"><br>\r\n\r\n</div>\r\n<div style=\"margin-top:0;margin-bottom:0;\"><br>\r\n\r\n</div>\r\n<div style=\"margin-top:0;margin-bottom:0;\"><br>\r\n\r\n</div>\r\n<div style=\"margin-top:0;margin-bottom:0;\"><br>\r\n\r\n</div>\r\n<div style=\"margin-top:0;margin-bottom:0;\">TEST</div>\r\n</span></font></div>\r\n</div>\r\n</div>\r\n</body></html>
Code to parse:
let doc: Document = try SwiftSoup.parse(contentHtml)
var text = try doc.text()
After parsing:
"TEST\r\n TEST\r\n TEST\r\n \r\n\r\n\r\n TEST\r\n TEST\r\n TEST\r\n \r\n\r\n\r\n \r\n\r\n\r\n TEST\r\n TEST\r\n TEST\r\n \r\n\r\n\r\n \r\n\r\n\r\n \r\n\r\n\r\n \r\n\r\n\r\n \r\n\r\n\r\n \r\n\r\n\r\n \r\n\r\n\r\n TEST"
First thanks for great library .
I'd like to extract video files from html documents , like by searching for .mp4 or something , how to do this with swiftsoup ?
The CleanerTest
file is outside of the SwiftSoupTests
directory meaning that it cannot be used with Swift Package Manager.
There are some errors in the new Xcode 9 (Swift 4) for String.swift file, that can be solved easily (I've commented the old code..) :
func indexOf(_ substring: String, _ offset: Int ) -> Int {
if(offset > characters.count) {return -1}
let maxIndex = self.characters.count - substring.characters.count
if(maxIndex >= 0) {
for index in offset...maxIndex {
let rangeSubstring = self.characters.index(self.startIndex, offsetBy: index)..<self.characters.index(self.startIndex, offsetBy: index + substring.characters.count)
if self[rangeSubstring] == substring {
//if self.substring(with: rangeSubstring) == substring {
return index
}
}
}
return -1
}
and:
static func split(_ value: String, _ offset: Int, _ count: Int) -> String {
let start = value.index(value.startIndex, offsetBy: offset)
let end = value.index(value.startIndex, offsetBy: count+offset)
let range = start..<end
//return value.substring(with: range)
return String(value[range])
}
Using doc.select("#comment")
as described in https://stackoverflow.com/questions/7541843/how-to-search-for-comments-using-jsoup doesn't return the comment nodes.
Example HTML:
<!-- a comment -->
Hello
As I am getting the below issue related to conversion of the swift 3 to swift 4 . So can you please update that to swift 4.
"multiplyWithOverflow' is unavailable: Use multipliedReportingOverflow(by:) instead."
Also please update your code for swift4.
Hello! I have a string:
hello<span class='smile'>TT</span>ios<span class='smile'>QQ</span>world
And I want to transform it to 5 custom objects:
[TheString, TheSmile, TheString, TheSmile, TheString]
This way I get an Element
from the string:
let element = try SwiftSoup.parse(string).body()!
Most of the time I do the parsing recursively, so I don't know the initial html string which constructed the Element
, but I have found the way to get this string:
let initialHtmlString = try html()
And I got this:
hello\n<span class='smile'>TT</span>ios\n<span class='smile'>QQ</span>world
Then I take each child's try outerHtml()
and cut it out from the string. In the end I got 5 objects:
TheString = hello\n
TheSmile = TT
TheString = ios\n
TheSmile = QQ
TheString = world
The problem is: 'try html()' adds new line symbol which affects the final result. Is there a way to get the result without undesired new line symbols?
Thanks
'empty' is inaccessible due to 'private' protection level
SwiftSoup
scheme builds well in the project.
However , when I try to manage it in Carthage , it builds failed .
I'am no sure which cause this error , the project itself or the Carthage?
Following is some of the the error message logged by Carthage, I hope you can give me some suggestion.
Xcode 8.2.1 (8C1002)
Swift 3.0.2
Carthage 0.23
SwiftSoup tag 1.4.2
Undefined symbols for architecture arm64:
"_FE9SwiftSoupScG9AmpersandSc", referenced from:
function signature specialization <Arg[0] = Owned To Guaranteed> of SwiftSoup.TokeniserState.read (SwiftSoup.Tokeniser, SwiftSoup.CharacterReader) throws -> () in TokeniserState.o
"_FE9SwiftSoupScG10BackslashFSc", referenced from:
function signature specialization <Arg[0] = Owned To Guaranteed> of SwiftSoup.TokeniserState.read (SwiftSoup.Tokeniser, SwiftSoup.CharacterReader) throws -> () in TokeniserState.o
"_FE9SwiftSoupScG8LessThanSc", referenced from:
function signature specialization <Arg[0] = Owned To Guaranteed> of SwiftSoup.TokeniserState.read (SwiftSoup.Tokeniser, SwiftSoup.CharacterReader) throws -> () in TokeniserState.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Ld /Users/umisky/Library/Caches/org.carthage.CarthageKit/DerivedData/SwiftSoup/1.2.9/Build/Intermediates/SwiftSoup.build/Release-iphoneos/SwiftSoup.build/Objects-normal/armv7/SwiftSoup normal armv7
cd /Users/umisky/Desktop/Reimu/Carthage/Checkouts/SwiftSoup
export IPHONEOS_DEPLOYMENT_TARGET=9.0
export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch armv7 -dynamiclib -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS10.2.sdk -L/Users/umisky/Library/Caches/org.carthage.CarthageKit/DerivedData/SwiftSoup/1.2.9/Build/Products/Release-iphoneos -F/Users/umisky/Library/Caches/org.carthage.CarthageKit/DerivedData/SwiftSoup/1.2.9/Build/Products/Release-iphoneos -filelist /Users/umisky/Library/Caches/org.carthage.CarthageKit/DerivedData/SwiftSoup/1.2.9/Build/Intermediates/SwiftSoup.build/Release-iphoneos/SwiftSoup.build/Objects-normal/armv7/SwiftSoup.LinkFileList -install_name @rpath/SwiftSoup.framework/SwiftSoup -Xlinker -rpath -Xlinker @executable_path/Frameworks -Xlinker -rpath -Xlinker @loader_path/Frameworks -miphoneos-version-min=9.0 -dead_strip -Xlinker -object_path_lto -Xlinker /Users/umisky/Library/Caches/org.carthage.CarthageKit/DerivedData/SwiftSoup/1.2.9/Build/Intermediates/SwiftSoup.build/Release-iphoneos/SwiftSoup.build/Objects-normal/armv7/SwiftSoup_lto.o -fembed-bitcode -Xlinker -bitcode_verify -Xlinker -bitcode_hide_symbols -Xlinker -bitcode_symbol_map -Xlinker /Users/umisky/Library/Caches/org.carthage.CarthageKit/DerivedData/SwiftSoup/1.2.9/Build/Products/Release-iphoneos -fobjc-link-runtime -L/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos -Xlinker -add_ast_path -Xlinker /Users/umisky/Library/Caches/org.carthage.CarthageKit/DerivedData/SwiftSoup/1.2.9/Build/Intermediates/SwiftSoup.build/Release-iphoneos/SwiftSoup.build/Objects-normal/armv7/SwiftSoup.swiftmodule -single_module -compatibility_version 1 -current_version 1 -Xlinker -dependency_info -Xlinker /Users/umisky/Library/Caches/org.carthage.CarthageKit/DerivedData/SwiftSoup/1.2.9/Build/Intermediates/SwiftSoup.build/Release-iphoneos/SwiftSoup.build/Objects-normal/armv7/SwiftSoup_dependency_info.dat -o /Users/umisky/Library/Caches/org.carthage.CarthageKit/DerivedData/SwiftSoup/1.2.9/Build/Intermediates/SwiftSoup.build/Release-iphoneos/SwiftSoup.build/Objects-normal/armv7/SwiftSoup
Undefined symbols for architecture armv7:
"_FE9SwiftSoupScG9AmpersandSc", referenced from:
function signature specialization <Arg[0] = Owned To Guaranteed> of SwiftSoup.TokeniserState.read (SwiftSoup.Tokeniser, SwiftSoup.CharacterReader) throws -> () in TokeniserState.o
"_FE9SwiftSoupScG8LessThanSc", referenced from:
function signature specialization <Arg[0] = Owned To Guaranteed> of SwiftSoup.TokeniserState.read (SwiftSoup.Tokeniser, SwiftSoup.CharacterReader) throws -> () in TokeniserState.o
ld: symbol(s) not found for architecture armv7
** BUILD FAILED **
The following build commands failed:
Ld /Users/umisky/Library/Caches/org.carthage.CarthageKit/DerivedData/SwiftSoup/1.2.9/Build/Intermediates/SwiftSoup.build/Release-iphoneos/SwiftSoup.build/Objects-normal/arm64/SwiftSoup normal arm64
(1 failure)
eg: let html: String = "
One one
<span style="color:#333333;font-family:"font-size:16px;background-color:#FFFFFF;">Two two
<span style="color:#333333;font-family:"font-size:16px;background-color:#FFFFFF;"> Three three
<span style="color:#333333;font-family:"font-size:16px;background-color:#FFFFFF;"> Four four"
let doc: Document = try SwiftSoup.parse(html)
return try doc.text()
Then, I want to joined '\n' with eath text, like this "One one \n Two two \n Three three..."
How can I do with it ? Thank you for your reply.
Example:
import Just
import SwiftSoup
let url: String = "http://comcast.net"
let response: HTTPResult = Just.get(url)
let data: Data = response.content
let html = String(data: data!, encoding: String.Encoding.utf8)
do {
let doc: Document = try SwiftSoup.parse(html!)
print(try doc.text())
}
catch {
print("Error")
}
It never prints anything, just runs forever
Showing multiple errors when compiling in the aove mentioned xcode, please correct.
Otherwise can't update with Carthage
» carthage update --platform watchOS
*** Fetching SwiftSoup
*** Checking out SwiftSoup at "1.6.2"
*** xcodebuild output can be found in /var/folders/wl/qnr2g12d0_b8gt90wzr0hlq40000gn/T/carthage-xcodebuild.NSZJeb.log
*** Building scheme "SwiftSoup-watchOS" in SwiftSoup.xcodeproj
Build Failed
Task failed with exit code 70:
/usr/bin/xcrun xcodebuild -project /Users/kristaps/Documents/ios/TartuWeatherProvider/Carthage/Checkouts/SwiftSoup/SwiftSoup.xcodeproj -scheme SwiftSoup-watchOS -configuration Release -derivedDataPath /Users/kristaps/Library/Caches/org.carthage.CarthageKit/DerivedData/9.2_9C40b/SwiftSoup/1.6.2 -sdk watchsimulator -destination platform=watchOS\ Simulator,id=5AE2A1D5-AF63-4E0B-BD98-E549C495F9AE -destination-timeout 3 ONLY_ACTIVE_ARCH=NO CODE_SIGNING_REQUIRED=NO CODE_SIGN_IDENTITY= CARTHAGE=YES build (launched in /Users/kristaps/Documents/ios/TartuWeatherProvider/Carthage/Checkouts/SwiftSoup)
This usually indicates that project itself failed to compile. Please check the xcodebuild log for more details: /var/folders/wl/qnr2g12d0_b8gt90wzr0hlq40000gn/T/carthage-xcodebuild.NSZJeb.log
SwiftSoup does not build on Linux with Swift 3.1 due to Apple helpfully renaming RegularExpression
to NSRegularExpression
on Linux in 3.1... I have no idea why either! I'll get a PR together which sorts this out and updates the CI scripts to run on 3.1 across everything
I tried using your code sample in my project.
do{
let unsafe: String = "<p><a href='http://example.com/' onclick='stealCookies()'>Link</a></p>"
let safe: String = try SwiftSoup.clean(unsafe, Whitelist.basic())!
// now: <p><a href="http://example.com/" rel="nofollow">Link</a></p>
}catch Exception.Error(let type, let message){
print(message)
}catch{
print("error")
}
There's an error: Type 'Whitelist' has no member 'basic'
. SwiftSoup.Whitelist.basic()
also isn't defined.
Looks like there should be Whitelist
with some pre-canned rules: https://jsoup.org/apidocs/org/jsoup/safety/Whitelist.html
Hello
Thanks for the project well i run pod install on example_ and after i run the project nothing appears how can i try it plz help?
A few build errors in the upcoming XCode 8.3 Beta from new Swift.
To check them, install the beta version of XCode from https://developer.apple.com/download/ alongside your normal XCode
I receive an error while making release saying the below message:
Undefined symbols for architecture armv7:
"_FE9SwiftSoupScG9AmpersandSc", referenced from:
function signature specialization <Arg[0] = Owned To Guaranteed> of SwiftSoup.TokeniserState.read (SwiftSoup.Tokeniser, SwiftSoup.CharacterReader) throws -> () in TokeniserState.o
"_FE9SwiftSoupScG8LessThanSc", referenced from:
function signature specialization <Arg[0] = Owned To Guaranteed> of SwiftSoup.TokeniserState.read (SwiftSoup.Tokeniser, SwiftSoup.CharacterReader) throws -> () in TokeniserState.o
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)
(debug works fine but only getting release generates the error)
Hi,
It would be nice if you can include an convenience initializer for URLs in the parse
method.
I added this to my Cartfile:
github "scinfu/SwiftSoup"
And then did this:
carthage update --platform mac
And it failed with:
*** Skipped building SwiftSoup due to the error:
Dependency "SwiftSoup" has no shared framework schemes for any of the platforms: Mac
Any suggestions? Thanks! :)
thank you html parser , it's a very smart tool like jsoup. but i found when i use it , the cpu is very high.
I compare it with other tool base on libxml2 (like Fuzi, kanna).i test in my project , fuzzy and kanna use 10%-15% cpu when parse one web site, but swiftsoup is 60% and more.
but I like this project because of liking jsoup too.
It misses Package.swift file:
import PackageDescription
let package = Package(
name: "SwiftSoup"
)
and Test has to be renamed to SwiftSoupTests.
The README needs a code example of how to get the entire Document instance and generate the full HTML of it back into a String including html, head, body sections. In the interim, how do I do it? the html() method seems to remove the head. I'm trying to sanitize html then load it into a WKWebView. Perhaps the clean method is removing it?
let str = try doc.html()
let html = "<html>\(str)</html>"
let wl:Whitelist = try Whitelist.relaxed().addEnforcedAttribute("a", "rel", "nofollow")
let safe: String = try SwiftSoup.clean(html, wl)! // the output starts with a div tag instead of html!
(the answer of issue #26 cannot solve my problem)
Hi, when I use parse() method to parse a html file, and then write the dom outer html to a new file, it will contain wrong spaces. For example, in the raw html, it has:
<div><p>a<p></div>
but in outerHtml():
<div>
<p>
a
</p>
</div>
in this case, the position of 'a' change when render the html page.
Is there any method or solution to solve this problem?
Using 'SwiftSoup' SDK to parse HTMl content from UIWebView. I want the image size and resolution for each and every images fetched from HTML content. How to get the image size and resolution from HTML content received from SwiftSoup?
I have a use case that involves reading a single-file HTML with <style> tags, and inlining the styles in the body's included tags. This would be for email HTML, where classes are not usually allowed, but inline styles are.
@param
baseUri
The URL where the HTML was retrieved from. Used to resolve relative URLs to absolute URLs, that occur before the HTML declares a<base href>
tag.
Is this parameter intended to resolve the value of any href
tag into an absolute URL?
<iframe src=\"https://www.googletagmanager.com/ns.html?id=GTM-M48W9J\"\n\t\t height=\"0\" width=\"0\" style=\"display:none;visibility:hidden\"></iframe>
Here are its attributes:
[
"src": SwiftSoup.Attribute,
"": SwiftSoup.BooleanAttribute,
"height": SwiftSoup.Attribute,
"width": SwiftSoup.Attribute,
"style": SwiftSoup.Attribute
]
It crashes in ParseSettings.normalizeAttributes()
on this line:
try attr.setKey(key: attr.getKey().lowercased())
because attr.getKey()
is empty.
SwiftSoup.parse(html, "https://9to5mac.com")
Hello,
if I have some HTML:
How can I determine if the input is checked or not? I've tried checking if the element has the attribute "checked" but that doesn't work, and when I print out all the attributes, checked isn't in the list.
I am randomly downloading html pages and using SwiftSoup to parse them (1.6.0)
The odd page just gives me the following
Could not cast value of type 'Swift.Optional<SwiftSoup.Element>' (0x103049718) to 'SwiftSoup.Element' (0x100b4ded0).
2018-02-15 19:21:05.242422+0000 burf[42885:2056856] Could not cast value of type 'Swift.Optional<SwiftSoup.Element>' (0x103049718) to 'SwiftSoup.Element' (0x100b4ded0).
HTML page url "http://policewb.gov.in/"
Seems to be something in
func replaceActiveFormattingElement(_ out: Element, _ input: Element)throws {
try formattingElements = replaceInQueue(formattingElements as! Array<Element>, out, input)//todo: testare as! non è bello
}
Is there anyway I can handle this issue without it killing my program
Could not compile 1.5.5 with Swift 3. An error is in the title.
Version: 1.5.5
File: Node.swift
Line: 788
How can I use SwiftSoup to make the font size larger for all text in an arbitrary document?
I'm getting this error when trying to use SwiftSoup in the XCode 9.0 Beta:
Module compiled with Swift 3.1 cannot be imported in Swift 3.2:
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.