Skip to content

Commit

Permalink
Updated to 1.6.2 version
Browse files Browse the repository at this point in the history
  • Loading branch information
ssamadgh committed Aug 25, 2019
1 parent f8b8f2f commit af0c459
Show file tree
Hide file tree
Showing 7 changed files with 82 additions and 42 deletions.
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<p align="center">
<a href="https://github.com/ssamadgh/WWDCsrt/releases" target="_blank">
<img src="https://img.shields.io/badge/Version-1.6.0-brightgreen.svg?style=flat" alt="app version 1.6.0">
<img src="https://img.shields.io/badge/Version-1.6.2-brightgreen.svg?style=flat" alt="app version 1.6.2">
</a>
<a href="https://developer.apple.com/swift/" target="_blank">
<img src="https://img.shields.io/badge/Swift-4.0-orange.svg?style=flat" alt="Swift 4.0">
Expand All @@ -25,6 +25,12 @@
#### An app for Download WWDC subtitles

### Whats New:

**version 1.6.2:**

- Now can download link of Sample codes for WWDC 2019, 2018, 2017, 2016 videos
- Some minor bugs fixed

**version 1.6.1:**

- WWDC 2019 Added.
Expand Down
Binary file modified Releases/WWDC.srt.zip
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@
condition = "self.sessionNumber == &quot;708&quot;"
continueAfterRunningActions = "No"
filePath = "WWDCSubGetter/ParseHtmlVideoPageOperation.swift"
timestampString = "571226522.972092"
timestampString = "588417031.690729"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "38"
Expand All @@ -316,11 +316,11 @@
condition = "self.sessionNumber == &quot;708&quot;"
continueAfterRunningActions = "No"
filePath = "WWDCSubGetter/ParseHtmlVideoPageOperation.swift"
timestampString = "571226522.972165"
timestampString = "588417031.690802"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "75"
endingLineNumber = "75"
startingLineNumber = "78"
endingLineNumber = "78"
landmarkName = "executeOld()"
landmarkType = "7">
</BreakpointContent>
Expand All @@ -333,7 +333,7 @@
condition = "self.sessionNumber == &quot;708&quot;"
continueAfterRunningActions = "No"
filePath = "WWDCSubGetter/ParseHtmlVideoPageOperation.swift"
timestampString = "571226522.9722281"
timestampString = "588417031.690853"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "46"
Expand All @@ -350,11 +350,11 @@
condition = "self.sessionNumber == &quot;708&quot;"
continueAfterRunningActions = "No"
filePath = "WWDCSubGetter/ParseHtmlVideoPageOperation.swift"
timestampString = "571226522.972288"
timestampString = "588417031.690889"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "83"
endingLineNumber = "83"
startingLineNumber = "86"
endingLineNumber = "86"
landmarkName = "executeOld()"
landmarkType = "7">
</BreakpointContent>
Expand All @@ -367,7 +367,7 @@
condition = "self.sessionNumber == &quot;708&quot;"
continueAfterRunningActions = "No"
filePath = "WWDCSubGetter/ParseHtmlVideoPageOperation.swift"
timestampString = "571226522.97235"
timestampString = "588417031.690924"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "51"
Expand All @@ -384,7 +384,7 @@
condition = "self.sessionNumber == &quot;708&quot;"
continueAfterRunningActions = "No"
filePath = "WWDCSubGetter/ParseHtmlVideoPageOperation.swift"
timestampString = "571226522.97242"
timestampString = "588417031.690958"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "61"
Expand All @@ -401,7 +401,7 @@
condition = "self.sessionNumber == &quot;708&quot;"
continueAfterRunningActions = "No"
filePath = "WWDCSubGetter/ParseHtmlVideoPageOperation.swift"
timestampString = "571226522.972479"
timestampString = "588417031.690992"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "67"
Expand All @@ -417,27 +417,11 @@
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "WWDCSubGetter/WWDCVideosController.swift"
timestampString = "571226522.97254"
timestampString = "588417031.691027"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "183"
endingLineNumber = "183"
landmarkName = "getStringContent(fromURL:)"
landmarkType = "7">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "WWDCSubGetter/WWDCVideosController.swift"
timestampString = "571226522.972903"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "213"
endingLineNumber = "213"
startingLineNumber = "261"
endingLineNumber = "261"
landmarkName = "downloadFile(urlString:forSession:)"
landmarkType = "7">
</BreakpointContent>
Expand All @@ -449,11 +433,11 @@
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "WWDCSubGetter/WWDCVideosController.swift"
timestampString = "571226522.973217"
timestampString = "588417031.691063"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "172"
endingLineNumber = "172"
startingLineNumber = "217"
endingLineNumber = "217"
landmarkName = "getStringContent(fromURL:)"
landmarkType = "7">
</BreakpointContent>
Expand Down Expand Up @@ -689,7 +673,7 @@
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "WWDCSubGetter/WWDCVideosController.swift"
timestampString = "571226522.973803"
timestampString = "588417031.691193"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "123"
Expand Down Expand Up @@ -721,7 +705,7 @@
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "WWDCSubGetter/WWDCVideosController.swift"
timestampString = "571226522.9741811"
timestampString = "588417031.6912481"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "92"
Expand Down
3 changes: 1 addition & 2 deletions WWDCSubGetter/Base.lproj/Main.storyboard
Original file line number Diff line number Diff line change
Expand Up @@ -510,7 +510,6 @@
</subviews>
</view>
<color key="borderColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
<color key="fillColor" red="0.83741801979999997" green="0.83743780850000005" blue="0.83742713930000001" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</box>
</subviews>
</customView>
Expand Down Expand Up @@ -645,7 +644,7 @@ DQ
<rect key="frame" x="44" y="42" width="37" height="17"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Label" id="XAd-t5-Ibg">
<font key="font" metaFont="system"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="textColor" name="textColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
Expand Down
2 changes: 1 addition & 1 deletion WWDCSubGetter/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.6.1</string>
<string>1.6.2</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>LSApplicationCategoryType</key>
Expand Down
5 changes: 4 additions & 1 deletion WWDCSubGetter/ParseHtmlVideoPageOperation.swift
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,12 @@ class ParseHtmlVideoPageOperation: Operation {
case .sampleCode:
let sampleCodesURLStrings = WWDCVideosController.getSampleCodeURL(fromHTML: htmlText)
let sampleCodesURLStrings2 = WWDCVideosController.getSampleCodeURL2(fromHTML: htmlText)

let sampleCodesURLStrings3 = WWDCVideosController.getSampleCodeURL3(fromHTML: htmlText)

linksModel.sampleCodesLinks.append(contentsOf: sampleCodesURLStrings)
linksModel.sampleCodesLinks.append(contentsOf: sampleCodesURLStrings2)
linksModel.sampleCodesLinks.append(contentsOf: sampleCodesURLStrings3)


}
}
Expand Down
52 changes: 50 additions & 2 deletions WWDCSubGetter/WWDCVideosController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,51 @@ class WWDCVideosController {
return sampleURLPaths
}

class func getSampleCodeURL3(fromHTML: String) -> [String] {
// let pat = "(href=\"[^ ]*?/content/samplecode/.*?=\")"
let pat = "href=\"([^ ]*?/documentation/.*?)\""
let regex = try! NSRegularExpression(pattern: pat, options: [])
let matches = regex.matches(in: fromHTML, options: [], range: NSRange(location: 0, length: fromHTML.count))
var sampleURLPaths : [String] = []
for match in matches {
let range = match.range(at: 1)
var path = (fromHTML as NSString).substring(with: range)

// Tack on the hostname if it's not already there (some URLs are listed as
// relative URL while some are fully-qualified).
let prefixReplacementString: String
if !path.contains("href=\"http") {
prefixReplacementString = "http(?:s)?://developer.apple.com"
} else {
prefixReplacementString = ""
}
path = path.replacingOccurrences(of: "href=\"", with: prefixReplacementString)

// Strip target attribute suffix
path = path.replacingOccurrences(of: "\" target=\"", with: "/")

sampleURLPaths.append(path)
}

var sampleArchivePaths : [String] = []
for urlPath in sampleURLPaths {
let htmlText = getStringContent(fromURL: urlPath)

let pat = "href=\"([^ ]*?/published/.*?.zip)\""
let regex = try! NSRegularExpression(pattern: pat, options: [])
let matches = regex.matches(in: htmlText, options: [], range: NSRange(location: 0, length: htmlText.count))
for match in matches {
let range = match.range(at: 1)
let path = (htmlText as NSString).substring(with: range)

sampleArchivePaths.append(path)
}

}

return sampleArchivePaths
}


class func getStringContent(fromURL: String) -> (String) {
/* Configure session, choose between:
Expand Down Expand Up @@ -184,8 +229,11 @@ class WWDCVideosController {
/* Success */
// let statusCode = (response as! NSHTTPURLResponse).statusCode
// print("URL Session Task Succeeded: HTTP \(statusCode)")
result = String.init(data: data!, encoding:
.utf8)!
if let data = data, let string = String.init(data: data, encoding:
.utf8) {
result = string

}
}
else {
/* Failure */
Expand Down

0 comments on commit af0c459

Please sign in to comment.